Created
August 28, 2021 13:37
-
-
Save techykajal/d89a13ea5b0b2d02a829a946b0461556 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # function to load dictionary and doc to term matrix from the file | |
| def load_dict_and_docterm_matirx(dict_path, matrix_path): | |
| """ | |
| This fucntion will load and return | |
| dictionary and doc term matrix | |
| Arguments: | |
| dict_path: path to corpus dictionary | |
| matrix_path: path to corpus document to term matrix | |
| returns: | |
| dictionary and doc-term matrix | |
| """ | |
| dictionary = corpora.Dictionary.load(dict_path) | |
| doc_term_matrix = corpora.MmCorpus(matrix_path) | |
| return dictionary, doc_term_matrix | |
| dictionary, doc_term_matrix = load_dict_and_docterm_matirx(dict_file_path, matrix_file_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment