Esempio n. 1
0
 def text_vector(self, text, laplace):
     text = nlp.tokens(text)
     vector = []
     for word in self.word_list:
         score = 1 if word in text else 0
         vector.append(score)
     return vector
Esempio n. 2
0
 def build_word_list(self):
     text, _ = load_data.load_questions(self.file_path)
     text = text[0::2]
     text = [nlp.tokens(t) for t in text]
     text = [word for sentence in text for word in sentence]
     text = list(set(text))
     text.sort()
     return text