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


Python parse.normalize函数代码示例

本文整理汇总了Python中mycroft.util.parse.normalize函数的典型用法代码示例。如果您正苦于以下问题:Python normalize函数的具体用法?Python normalize怎么用?Python normalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了normalize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_spaces_fr

 def test_spaces_fr(self):
     self.assertEqual(normalize("  c'est   le     test", lang="fr-fr"),
                      "c'est test")
     self.assertEqual(normalize("  c'est  le    test  ", lang="fr-fr"),
                      "c'est test")
     self.assertEqual(normalize("  c'est     un    test", lang="fr-fr"),
                      "c'est 1 test")
开发者ID:MycroftAI,项目名称:mycroft-core,代码行数:7,代码来源:test_parse_fr.py

示例2: test_spaces

 def test_spaces(self):
     self.assertEqual(normalize("  this   is  a    test"),
                      "this is test")
     self.assertEqual(normalize("  this   is  a    test  "),
                      "this is test")
     self.assertEqual(normalize("  this   is  one    test"),
                      "this is 1 test")
开发者ID:antlarr,项目名称:mycroft-core,代码行数:7,代码来源:test_parse.py

示例3: test_articles_es

 def test_articles_es(self):
     self.assertEqual(normalize("esta es la prueba", lang="es",
                                remove_articles=True),
                      "esta es prueba")
     self.assertEqual(normalize("y otra prueba", lang="es",
                                remove_articles=True),
                      "y otra prueba")
开发者ID:antlarr,项目名称:mycroft-core,代码行数:7,代码来源:test_parse.py

示例4: test_spaces_pt

 def test_spaces_pt(self):
     self.assertEqual(normalize("  isto   e  o    teste", lang="pt"),
                      "isto teste")
     self.assertEqual(normalize("  isto   sao os    testes  ", lang="pt"),
                      "isto sao testes")
     self.assertEqual(normalize("  isto   e  um    teste", lang="pt",
                                remove_articles=False),
                      "isto e 1 teste")
开发者ID:antlarr,项目名称:mycroft-core,代码行数:8,代码来源:test_parse.py

示例5: test_agressive_pruning_pt

 def test_agressive_pruning_pt(self):
     self.assertEqual(normalize("uma palavra", lang="pt"),
                      "1 palavra")
     self.assertEqual(normalize("esta palavra um", lang="pt"),
                      "palavra 1")
     self.assertEqual(normalize("o homem batia-lhe", lang="pt"),
                      "homem batia")
     self.assertEqual(normalize("quem disse asneira nesse dia", lang="pt"),
                      "quem disse asneira dia")
开发者ID:antlarr,项目名称:mycroft-core,代码行数:9,代码来源:test_parse.py

示例6: test_articles_pt

 def test_articles_pt(self):
     self.assertEqual(normalize(u"isto � o teste",
                                lang="pt", remove_articles=True),
                      u"isto teste")
     self.assertEqual(
         normalize(u"isto � a frase", lang="pt", remove_articles=True),
         u"isto frase")
     self.assertEqual(
         normalize("e outro teste", lang="pt", remove_articles=True),
         "outro teste")
开发者ID:antlarr,项目名称:mycroft-core,代码行数:10,代码来源:test_parse.py

示例7: test_articles

 def test_articles(self):
     self.assertEqual(
         normalize("dies ist der test", lang="de-de", remove_articles=True),
         "dies ist test")
     self.assertEqual(
         normalize("und noch ein Test", lang="de-de", remove_articles=True),
         "und noch 1 Test")
     self.assertEqual(normalize("dies ist der Extra-Test", lang="de-de",
                                remove_articles=False),
                      "dies ist der Extra-Test")
开发者ID:Dark5ide,项目名称:mycroft-core,代码行数:10,代码来源:test_parse_de.py

示例8: test_articles

 def test_articles(self):
     self.assertEqual(normalize("this is a test", remove_articles=True),
                      "this is test")
     self.assertEqual(normalize("this is the test", remove_articles=True),
                      "this is test")
     self.assertEqual(normalize("and another test", remove_articles=True),
                      "and another test")
     self.assertEqual(normalize("this is an extra test",
                                remove_articles=False),
                      "this is an extra test")
开发者ID:antlarr,项目名称:mycroft-core,代码行数:10,代码来源:test_parse.py

示例9: test_articles

 def test_articles(self):
     self.assertEqual(
         normalize("dette er en test", lang="da-dk", remove_articles=True),
         "dette er 1 test")
     self.assertEqual(
         normalize("og endnu en test", lang="da-dk", remove_articles=True),
         "og endnu 1 test")
     self.assertEqual(normalize("dette er en extra-test",
                                lang="da-dk", remove_articles=False),
                      "dette er 1 extra-test")
开发者ID:MycroftAI,项目名称:mycroft-core,代码行数:10,代码来源:test_parse_da.py

示例10: test_spaces_it

 def test_spaces_it(self):
     self.assertEqual(normalize(u"questo   e'  il    test",
                                lang="it"), u"questo e' test")
     self.assertEqual(normalize(u"questo   è    un    test  ",
                                lang="it"), u"questo è 1 test")
     self.assertEqual(normalize(u"un  altro test  ",
                                lang="it"), u"1 altro test")
     self.assertEqual(normalize(u"questa è un'  altra amica   ", lang="it",
                                remove_articles=False),
                      u"questa è 1 altra amica")
     self.assertEqual(normalize(u"questo   è  un    test   ", lang="it",
                                remove_articles=False), u"questo è 1 test")
开发者ID:seymour-bootay,项目名称:mycroft-core,代码行数:12,代码来源:test_parse_it.py

示例11: test_numbers

 def test_numbers(self):
     self.assertEqual(
         normalize("dette er en to tre test", lang="da-dk"),
         "dette er 1 2 3 test")
     self.assertEqual(
         normalize("dette er fire fem seks test", lang="da-dk"),
         "dette er 4 5 6 test")
     self.assertEqual(
         normalize("dette er syv otte ni test", lang="da-dk"),
         "dette er 7 8 9 test")
     self.assertEqual(
         normalize("dette er ti elve tolv test", lang="da-dk"),
         "dette er 10 11 12 test")
开发者ID:MycroftAI,项目名称:mycroft-core,代码行数:13,代码来源:test_parse_da.py

示例12: test_spaces_it

 def test_spaces_it(self):
     """
     Test cases for Italian remove spaces
     """
     self.assertEqual(normalize('questo   è    un    test  ',
                                lang='it'), 'questo è 1 test')
     self.assertEqual(normalize('un  altro test  ',
                                lang='it'), '1 altro test')
     self.assertEqual(normalize('questa è un\'  altra amica   ', lang='it',
                                remove_articles=False),
                      'questa è 1 altra amica')
     self.assertEqual(normalize('questo   è  un    test   ', lang='it',
                                remove_articles=False), 'questo è 1 test')
开发者ID:MycroftAI,项目名称:mycroft-core,代码行数:13,代码来源:test_parse_it.py

示例13: test_articles_fr

 def test_articles_fr(self):
     self.assertEqual(normalize("c'est le test", remove_articles=True,
                                lang="fr-fr"),
                      "c'est test")
     self.assertEqual(normalize("et l'autre test", remove_articles=True,
                                lang="fr-fr"),
                      "et autre test")
     self.assertEqual(normalize("et la tentative", remove_articles=True,
                                lang="fr-fr"),
                      "et tentative")
     self.assertEqual(normalize("la dernière tentative",
                                remove_articles=False, lang="fr-fr"),
                      "la dernière tentative")
开发者ID:MycroftAI,项目名称:mycroft-core,代码行数:13,代码来源:test_parse_fr.py

示例14: test_articles_it

 def test_articles_it(self):
     self.assertEqual(normalize(u"questo è il test",
                                lang="it", remove_articles=True),
                      u"questo è test")
     self.assertEqual(normalize(u"questa è la frase",
                                lang="it", remove_articles=True),
                      u"questa è frase")
     self.assertEqual(normalize(u"questo è lo scopo", lang="it",
                                remove_articles=True),
                      u"questo è scopo")
     self.assertEqual(normalize(u"questo è il test extra",
                                lang="it", remove_articles=False),
                      u"questo è il test extra")
开发者ID:seymour-bootay,项目名称:mycroft-core,代码行数:13,代码来源:test_parse_it.py

示例15: test_numbers_pt

 def test_numbers_pt(self):
     self.assertEqual(normalize(u"isto e o um dois tr�s teste", lang="pt"),
                      u"isto 1 2 3 teste")
     self.assertEqual(normalize(u"� a sete oito nove  test", lang="pt"),
                      u"7 8 9 test")
     self.assertEqual(
         normalize("teste zero dez onze doze treze", lang="pt"),
         "teste 0 10 11 12 13")
     self.assertEqual(
         normalize("teste mil seiscentos e sessenta e seis", lang="pt",
                   remove_articles=False),
         "teste 1000 600 e 66")
     self.assertEqual(
         normalize("teste sete e meio", lang="pt",
                   remove_articles=False),
         "teste 7 e meio")
     self.assertEqual(
         normalize("teste dois ponto nove", lang="pt"),
         "teste 2 ponto 9")
     self.assertEqual(
         normalize("teste cento e nove", lang="pt",
                   remove_articles=False),
         "teste 100 e 9")
     self.assertEqual(
         normalize("teste vinte e 1", lang="pt"),
         "teste 20 1")
开发者ID:antlarr,项目名称:mycroft-core,代码行数:26,代码来源:test_parse.py


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