(self, file_path, topk=3, keyword_matching_func=bm25)
| 22 | class KnowledgeExtraction(): |
| 23 | |
| 24 | def __init__(self, file_path, topk=3, keyword_matching_func=bm25): |
| 25 | |
| 26 | # select an attribute in the jsons to embed |
| 27 | self.names = {"matched_attr": "cause_name"} |
| 28 | self.cause_name = self.names["matched_attr"] |
| 29 | |
| 30 | nltk.download('stopwords') |
| 31 | nltk.download('punkt') |
| 32 | nltk.download('averaged_perceptron_tagger') |
| 33 | nltk.download('wordnet') |
| 34 | self.wnl = WordNetLemmatizer() |
| 35 | self.keyword_matching_func = keyword_matching_func |
| 36 | |
| 37 | self.topk = topk |
| 38 | |
| 39 | self.corpus, self.preprocessed_corpus, self.matched_attr, self.stop_words = self.knowledge_load(file_path) |
| 40 | |
| 41 | def knowledge_load(self, file_path): |
| 42 |
nothing calls this directly
no test coverage detected