本文整理汇总了Python中category.Category._make方法的典型用法代码示例。如果您正苦于以下问题:Python Category._make方法的具体用法?Python Category._make怎么用?Python Category._make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类category.Category
的用法示例。
在下文中一共展示了Category._make方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: construct_compound_tense_subjunctive
# 需要导入模块: from category import Category [as 别名]
# 或者: from category.Category import _make [as 别名]
def construct_compound_tense_subjunctive(infinitive, tense):
past_participle = _construct_past_participle(infinitive)
inflection = [("qu'" if f(aux)[0] in _VOWELS else 'que',
f(aux), aux, past_participle)
for f, aux in zip(_PRONOUNS,
_COMPOUND_TENSE[tense])]
return Category._make(inflection)
示例2: output_cloze
# 需要导入模块: from category import Category [as 别名]
# 或者: from category.Category import _make [as 别名]
def output_cloze(infinitive, tense, conj):
'''
Combines the different parts of a verb conjugation with
Anki's required formatting to produce a form suitable
for a cloze-deletion card
'''
result = []
# TODO - make this pythonic, it's an ugly hack as it is
for i, item in enumerate(conj):
if i == 0 and infinitive[0] in _VOWELS:
result.append(_FPS_CLOZE_FORMAT.format(item[0], item[1],
infinitive, tense))
else:
result.append(_STD_CLOZE_FORMAT.format(item[0], item[1],
infinitive, tense))
return Category._make(result)
示例3: construct_stem_and_ending
# 需要导入模块: from category import Category [as 别名]
# 或者: from category.Category import _make [as 别名]
def construct_stem_and_ending(infinitive, tense):
'''
Given an infinitive and a tense, looks up the appropriate
transformation rules and concatenates the resultant stem and
ending
'''
stem = _STEM_RULES[tense](infinitive)
verb_type = infinitive[-2:]
with sqlite3.connect('verb_trainer.db') as con:
cur = con.cursor()
cur.execute("SELECT fps, sps, tps, fpp, spp, tpp FROM tense_endings"
"WHERE verb_type = ? AND tense_id = "
"(SELECT tense_id FROM tenses WHERE tense_name = ?)",
(verb_type, tense))
endings = cur.fetchone()
return Category._make([stem + end for end in endings])
示例4: construct_simple_tense_output
# 需要导入模块: from category import Category [as 别名]
# 或者: from category.Category import _make [as 别名]
def construct_simple_tense_output(inflection):
output = []
if inflection.fps.verb[0] in _VOWELS:
output.append(_FPS_FORMAT.format(inflection.fps.pronoun,
inflection.fps.verb))
else:
output.append(_STD_FORMAT.format(inflection.fps.pronoun,
inflection.fps.verb))
output.append(_STD_FORMAT.format(inflection.sps.pronoun,
inflection.sps.verb))
output.append(_STD_FORMAT.format(inflection.tps.pronoun,
inflection.tps.verb))
output.append(_STD_FORMAT.format(inflection.fpp.pronoun,
inflection.fpp.verb))
output.append(_STD_FORMAT.format(inflection.spp.pronoun,
inflection.spp.verb))
output.append(_STD_FORMAT.format(inflection.tpp.pronoun,
inflection.tpp.verb))
return Category._make(output)
示例5: output_cloze_import
# 需要导入模块: from category import Category [as 别名]
# 或者: from category.Category import _make [as 别名]
def output_cloze_import(infinitive, tense, translation, sound, conj):
'''
Combines the output of the output_cloze function with optional
translation and sound fields and combines them to produce the
format required for Anki's import function
'''
cloze = output_cloze(infinitive, tense, conj)
if translation:
add_trn = [cz + ('|{}'.format(trn)) for cz, trn in
zip(cloze, translation)]
else:
add_trn = [cz + '|' for cz in cloze]
if sound:
add_snd = [trn + ('|[sound:{}]'.format(snd)) for
trn, snd in zip(add_trn, sound)]
else:
add_snd = [trn + '|' for trn in add_trn]
add_tag = [snd + ('|{}'.format(infinitive)) for snd in add_snd]
return Category._make(add_tag)
示例6: construct_simple_tense
# 需要导入模块: from category import Category [as 别名]
# 或者: from category.Category import _make [as 别名]
def construct_simple_tense(infinitive, tense):
stem_and_ending = construct_stem_and_ending(infinitive, tense)
inflection = [(f(c), c) for f, c in zip(_PRONOUNS, stem_and_ending)]
return Category._make([SimpleTenseParts._make(inf) for inf in inflection])
示例7: construct_compound_tense
# 需要导入模块: from category import Category [as 别名]
# 或者: from category.Category import _make [as 别名]
def construct_compound_tense(infinitive, tense):
past_participle = _construct_past_participle(infinitive)
inflection = [(f(aux), aux, past_participle)
for f, aux in zip(_PRONOUNS,
_COMPOUND_TENSE[tense])]
return Category._make(inflection)
示例8: construct_simple_tense_subjunctive
# 需要导入模块: from category import Category [as 别名]
# 或者: from category.Category import _make [as 别名]
def construct_simple_tense_subjunctive(infinitive, tense):
stem_and_ending = construct_stem_and_ending(infinitive, tense)
return Category._make([("qu'" if f(c)[0] in _VOWELS else 'que', f(c), c)
for f, c in zip(_PRONOUNS, stem_and_ending)])