def get_verbs(tuple_result): verbs = {} for identifier in tuple_result: verb_model = Model(True) for single_tuple in tuple_result[identifier]: verb = single_tuple['verb'] if verb not in NO_NEED: verb_model.update(text_list=[verb]) verb_model.normalize() for verb in verb_model.model: if verb not in verbs: verbs[verb] = 0 verbs[verb] += verb_model.model[verb] return verbs
def get_models(results,index_dir): models = {} for qid in results: if qid not in models: models[qid] = {} for day in results[qid]: single_model = Model(True,need_stem=True) for tid in results[qid][day]: text = get_text(index_dir,tid) if text: single_model.update(text_string=text) single_model.normalize() models[qid][day] = single_model.model return models
def get_all_verbs(example_result_tuples): verb_model = Model(True, need_stem=True) for single_tuple in example_result_tuples: word = single_tuple['verb'] if single_tuple['verb_label'] != 'VB': word = WordNetLemmatizer().lemmatize(word, 'v') try: verb_model.update(text_list=[str(word)]) except TypeError: print "Wrong Word!" print word print type(word) print single_tuple sys.exit(0) verb_model.normalize() return verb_model
def get_all_verbs(result_tuples): verb_model = Model(False,need_stem=False) for single_tuple in result_tuples: word = single_tuple['verb'] # if single_tuple['verb_label'] != 'VB': # word = WordNetLemmatizer().lemmatize(word,'v') try: verb_model.update(text_list=[str(word)]) except TypeError: print "Wrong Word!" print word print type(word) print single_tuple sys.exit(0) verb_model.to_dirichlet() return verb_model
def get_all_verbs(example_result_tuples): verb_model = Model(True,need_stem=True) for single_tuple in example_result_tuples: word = single_tuple['verb'] if single_tuple['verb_label'] != 'VB': word = WordNetLemmatizer().lemmatize(word,'v') try: verb_model.update(text_list=[str(word)]) except TypeError: print "Wrong Word!" print word print type(word) print single_tuple sys.exit(0) verb_model.normalize() return verb_model
def get_all_verbs(result_tuples): verb_model = Model(False, need_stem=False) for single_tuple in result_tuples: word = single_tuple['verb'] # if single_tuple['verb_label'] != 'VB': # word = WordNetLemmatizer().lemmatize(word,'v') try: verb_model.update(text_list=[str(word)]) except TypeError: print "Wrong Word!" print word print type(word) print single_tuple sys.exit(0) verb_model.to_dirichlet() return verb_model