Найти - Пользователи
Полная версия: wordnet
Начало » Центр помощи » wordnet
1
Ira
помогите пожалуйста!!!
мне нужно:
вывести слова с Wordnet, которые могут быть и глаголом и существительным.

Ira
да,я видела сайт, но все ровно не знаю,как написать цикл(
sergeek
import re
WORD = re.compile('([a-z_A-Z 0-9\']+)')
NOUN = re.compile(r'\t\[m1\]\[p\]noun')
VERB = re.compile(r'\t\[m1\]\[p\]verb')
res = []
verb = noun = word = False
with open('/home/sergeek/Downloads/dictionary/use/EnEn/Other/En-En-WordNet3.27-07-2009/En-En-WordNet3_gl_1_0.dsl','r',encoding='utf-16') as f:
    for line in iter(f.readline, ''):
        new_word = WORD.match(line)
        if new_word:
            if noun and verb:
                print(word)
                res.append(word)
            word = new_word.group(1)
            noun = verb = False
        if NOUN.match(line):
            noun = True
        if VERB.match(line):
            verb = True
            
вроде бы так если я правильно понял задачу
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB