美文网首页python
2020-08-06 英文复数

2020-08-06 英文复数

作者: Python_Camp | 来源:发表于2020-08-06 15:15 被阅读0次

输入需要处理的单词 words

words = ['zoo','bamboo','radio',
'studio','echo', 'ox',
'torpedo','baby','bus',
'box','boy','match',
'fly','paper','glue']

规则变量初始化

vowel = set('aeiou')
es = {'s','x','sh','ch'}
words = ['own','owe','owel']

def dual_vow(w): #dual_vow
return all(c in vowel for c in w[-2:])

def isVow_y(w): #cons+dual_vow
it = iter(w[-2:])
return next(it) in vowel and next(it) == 'y'

def isCon_y(w): #dual_vow
it = iter(w[-2:])
return next(it) not in vowel and next(it) == 'y'

def isEs(w): #{'s','x','sh','ch'}

it = iter(w[-2:])
return w[-1] in es or w[-2:] in es

irregular = ['bus','potato','tomato','hero',
'chief','roof','knife']

不规则单词需要手动持续添加

主函数

def plural(words):

Dual_vow = list(map(lambda x:x+'s',filter(dual_vow,words)))

IsVow_y = list(map(lambda x:x+'s',filter(isVow_y,words)))

IsCon_y = list(map(lambda x:x+'ies',filter(isCon_y,words)))

IsEs = list(map(lambda x:x+'es',filter(isEs,words)))

return {'Dual_vow':Dual_vow,

        'IsVow_y':IsVow_y,

        'IsCon_y':IsCon_y,

        'IsEs':IsEs}

print(plural(words))

相关文章

  • 2020-08-06 英文复数

    输入需要处理的单词 words words = ['zoo','bamboo','radio','studio',...

  • 学习日记 | 英语-单复数

    英文中1个以上即为复数,这点与中文不同。中文在单词上没有单复数之分,全靠量词。 英文涉及到单复数,会影响名词和动词...

  • 英语如何表达一类名词呢?

    英文表达一类: 名词表达分四类: a +名词单数, the +名词单数, 名词复数,the +名词复数 加a表泛指...

  • “女人”这个称呼的来历

    “女人”英文单数叫“Woman”,复数叫“Women”,与“男子”的英文“Man、Men”关联度很高,只是多了一个...

  • 英语零基础语法4

    名词变复数 英文中名词分可数名词和不可数名词。可数名词有单数和复数两种形式。名词变复数规则如下。 一般名词词尾加“...

  • ruby 英文单数复数转换

    rails的 active_support 实现了英文单词大小写转换功能

  • Anaconda再谈

    **Author By Bing **On 2020-08-06 [toc] 1. Anaconda简介 1.1 ...

  • 如何避免翻译腔——千之

    比如,英文中的复数形式 "s" 该如何翻译呢?回到本文开头那个句子: The judge let the man ...

  • 炽天使(Seraphim)

    炽天使(或音译撒拉弗、西拉冰;希伯来文:שׂרף, 复数 שׂרפים ;英文:单数为Seraph,众数为Sera...

  • 今日英语学习

    ✨让你的英文不再错(P 25 - 26) expectation n. (一般用复数)期望 The four-st...

网友评论

    本文标题:2020-08-06 英文复数

    本文链接:https://www.haomeiwen.com/subject/zwozrktx.html