當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。