当前位置: 首页>>代码示例>>Python>>正文


Python normality.normalize方法代码示例

本文整理汇总了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) 
开发者ID:occrp,项目名称:cronosparser,代码行数:10,代码来源:parser.py

示例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(' ')) 
开发者ID:pudo,项目名称:normality,代码行数:9,代码来源:test_normality.py

示例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)) 
开发者ID:pudo,项目名称:normality,代码行数:8,代码来源:test_normality.py

示例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 
开发者ID:pudo-attic,项目名称:jsonmapping,代码行数:11,代码来源:transforms.py

示例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] 
开发者ID:alephdata,项目名称:followthemoney,代码行数:6,代码来源:identifier.py

示例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 
开发者ID:alephdata,项目名称:followthemoney,代码行数:11,代码来源:compare.py


注:本文中的normality.normalize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。