本文整理汇总了Python中feature.Feature.languages方法的典型用法代码示例。如果您正苦于以下问题:Python Feature.languages方法的具体用法?Python Feature.languages怎么用?Python Feature.languages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feature.Feature
的用法示例。
在下文中一共展示了Feature.languages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dryer_data2
# 需要导入模块: from feature import Feature [as 别名]
# 或者: from feature.Feature import languages [as 别名]
def dryer_data2(*feature_names):
# data[area][genus][(feature_values)] = langauge_count
data = {}
# Languages that all features have
languages = set()
g = Genealogy()
feature = Feature(feature_names[0])
for language in feature.languages():
languages.add(language.code)
for feature_name in feature_names:
feature = Feature(feature_name)
this_set = set()
for language in feature.languages():
this_set.add(language.code)
languages &= this_set
for language_code in languages:
language = g.find_language_by_code(language_code)
area = language.area
genus = language.genus.name
value = ','.join(v['description'] for v in sorted(language.features.values()))
data.setdefault(area, {})
data[area].setdefault(genus, {})
data[area][genus].setdefault(value, 0)
data[area][genus][value] += 1
return data