def get_score(text): words = get_words(text) max_senses = 1 for word in words: for form in morph.parse(word): normal_form = form.normal_form if form.tag.POS == 'NOUN' and normal_form in senses: max_senses = max(max_senses, len(senses[normal_form])) return max_senses
def get_score(text): words = get_words(text) if len(words) == 0: return 0 cnt = 0 for word in words: for form in morph.parse(word): if form.score < 0.1: continue if form.tag.POS in {'VERB', 'INFN', 'GRND', 'PRTF', 'PRTS'}: cnt += 1 break return 1.0 * cnt / len(words)
def get_score(text): words = get_words(text) if len(words) == 0: return 0 cnt = 0 for word in words: for form in morph.parse(word): if form.score < 0.1: continue if form.tag.POS in {'ADJF', 'ADJS', 'COMP'}: cnt += 1 break return 1.0 * cnt / len(words)
def get_word_array(text): array = [] for word in get_words(text): all_forms = {} for form in morph.parse(word): if form.score < 0.1: continue normalized_word, score = get_pos_form(form.normal_form) if normalized_word is not None and normalized_word in wv.vocab: if normalized_word not in all_forms: all_forms[normalized_word] = 0 all_forms[normalized_word] += score * form.score if len(all_forms) != 0: array.append((word, all_forms)) return array