本文整理汇总了Python中normality.normalize方法的典型用法代码示例。如果您正苦于以下问题:Python normality.normalize方法的具体用法?Python normality.normalize怎么用?Python normality.normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类normality
的用法示例。
在下文中一共展示了normality.normalize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_csv_file_name
# 需要导入模块: import normality [as 别名]
# 或者: from normality import normalize [as 别名]
def make_csv_file_name(meta, table, out_folder):
bank_name = normalize(meta['BankName'], lowercase=False)
if bank_name is None:
bank_name = 'Untitled Database'
table_abbr = normalize(table['abbr'], lowercase=False)
table_name = normalize(table['name'], lowercase=False)
file_name = '%s - %s - %s.csv' % (bank_name, table_abbr, table_name)
return os.path.join(out_folder, file_name)
示例2: test_empty
# 需要导入模块: import normality [as 别名]
# 或者: from normality import normalize [as 别名]
def test_empty(self):
self.assertEqual(None, slugify(None))
self.assertEqual(None, ascii_text(None))
self.assertEqual(None, latinize_text(None))
self.assertEqual(None, normalize(None))
self.assertEqual(None, normalize(''))
self.assertEqual(None, normalize(' '))
示例3: test_petro
# 需要导入模块: import normality [as 别名]
# 或者: from normality import normalize [as 别名]
def test_petro(self):
text = u'Порошенко Петро Олексійович'
self.assertEqual('porosenko-petro-oleksijovic', slugify(text))
self.assertEqual('Porosenko Petro Oleksijovic', ascii_text(text))
self.assertEqual(u'Porošenko Petro Oleksíjovič', latinize_text(text))
self.assertEqual(u'порошенко петро олексіиович', normalize(text))
示例4: clean
# 需要导入模块: import normality [as 别名]
# 或者: from normality import normalize [as 别名]
def clean(mapping, bind, values):
""" Perform several types of string cleaning for titles etc.. """
categories = {'C': ' '}
for value in values:
if isinstance(value, six.string_types):
value = normality.normalize(value, lowercase=False, collapse=True,
decompose=False,
replace_categories=categories)
yield value
示例5: normalize
# 需要导入模块: import normality [as 别名]
# 或者: from normality import normalize [as 别名]
def normalize(self, text, **kwargs):
"""Normalize for comparison."""
ids = super(IdentifierType, self).normalize(text, **kwargs)
return [normalize(i) for i in ids]
示例6: compare_names
# 需要导入模块: import normality [as 别名]
# 或者: from normality import normalize [as 别名]
def compare_names(left, right):
result = 0
left_list = [normalize(n, latinize=True) for n in left.names]
right_list = [normalize(n, latinize=True) for n in right.names]
for (left, right) in itertools.product(left_list, right_list):
similarity = jaro(left, right)
score = similarity * dampen(2, 20, shortest(left, right))
result = max(result, score)
return result