(self, words, id_list, match_strategy='vote', vote_threshold=0.75, key_weight = {'bow': 1, 'tfidf': 1, 'ngram_tfidf': 1})
| 114 | |
| 115 | |
| 116 | def predict(self, words, id_list, match_strategy='vote', vote_threshold=0.75, key_weight = {'bow': 1, 'tfidf': 1, 'ngram_tfidf': 1}): |
| 117 | res = self._predict( words ) |
| 118 | if match_strategy == 'vote': |
| 119 | a_res_dic = self.vote(res, vote_threshold, key_weight)[1] |
| 120 | return dict(zip( id_list, [a_res_dic[i] for i in id_list] )) |
| 121 | if match_strategy == 'score': |
| 122 | a_res_dic = self.score(res, vote_threshold, key_weight)[1] |
| 123 | return dict(zip( id_list, [a_res_dic[i] for i in id_list] )) |
| 124 |