python将英语中的复数名词变成单数名词 |
您所在的位置:网站首页 › real转化为名词 › python将英语中的复数名词变成单数名词 |
python将英语中的复数名词变成单数名词
英语复数名词的常见构成方式
元音字母和大多数除s,z,x,sh,ch之外的辅音字母(或字母组合)直接加-s,清辅音后的s读作/s/ ,元音和浊辅音后的s读作/z/。如:bag-bags,biscuit-biscuits,egg-eggs.
当单数名词结尾为se,ze,ge,ce时(其词尾辅音为/s,z,ʃ,ʒ/等),加s后读作/iz/ 如vase-vases,fridge-fridges 当单数名词结尾为s,z,x,sh,软音ch时(其词尾辅音为/s,z,ʃ,ʒ/等)加-es(读/iz/), 如:box-boxes, peach-peaches. (o有时也是,但es读音为/z/如hero-heroes)例外:stomach-stomachs(因ch读作/k/) 不规则变化,如:ox-oxen, child-children, man-men,mouse-mice,louse-lice 不变化,如:deer-deer, sheep-sheep以及集体名词people-people,Chinese-Chinese。 在中间加s,用于连词,如:hanger_on-hangers_on,maid_of_honor-maids_of_honor. 可数名词以辅音字母+y结尾,把y去掉再加ies,如:hobby-hobbies,factory-factories. 含有oo的可数名词,把oo变成ee,如:foot- feet,tooth-teeth. 以f或fe结尾的单词,将f或fe去掉,加上ves,如:scarf-scarves,knife-knives 另外,英语有不少词汇借自其它语言,欧洲语言祖先之一的拉丁词汇有不少被完整地引入其中,复数变化规则也没改。 词尾um或on,复数变为a,如album-alba,minimum-minima,phenomenon-phenomena 词尾为us,复数变为i,如radius-radii,narcissus-narcissi 词尾为a,复数加e,如alga-algae,larva-larvae 所有各种形式的复数名词都可以变成单数名词。具体程序如下 from nltk import word_tokenize, pos_tag from nltk.corpus import wordnet from nltk.stem import WordNetLemmatizer # 获取单词的词性 def get_wordnet_pos(tag): if tag.startswith('J'): return wordnet.ADJ elif tag.startswith('V'): return wordnet.VERB elif tag.startswith('N'): return wordnet.NOUN elif tag.startswith('R'): return wordnet.ADV else: return None sentence = 'feet' # 举个例子 tokens = word_tokenize(sentence) # 分词 tagged_sent = pos_tag(tokens) # 获取单词词性 wnl = WordNetLemmatizer() lemmas_sent = [] for tag in tagged_sent: wordnet_pos = get_wordnet_pos(tag[1]) or wordnet.NOUN lemmas_sent.append(wnl.lemmatize(tag[0], pos=wordnet_pos)) # 词形还原 print(" ".join(lemmas_sent)) |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |