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


Python Unihandecoder.decode方法代码示例

本文整理汇总了Python中unihandecode.Unihandecoder.decode方法的典型用法代码示例。如果您正苦于以下问题:Python Unihandecoder.decode方法的具体用法?Python Unihandecoder.decode怎么用?Python Unihandecoder.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unihandecode.Unihandecoder的用法示例。


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

示例1: test_kana

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_kana(self):
     u = Unihandecoder(lang="ja")
     for n in xrange(0x3000,0x30ff):
         # Just check that it doesn't throw an exception
         try:
             t = unichr(n)
             u.decode(t)
         except:
             print "catch error at %02x"%n
开发者ID:Navinum,项目名称:unihandecode,代码行数:11,代码来源:basic_2.py

示例2: test_combining_chars

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_combining_chars(self):
     TESTS = [
             ("\u0031\u20de",    "1"),
                 ]
     u = Unihandecoder(lang="ja")
     for input, output in TESTS:
         self.failUnlessEqual(u.decode(input), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:9,代码来源:basic_3.py

示例3: test_squared_chars

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_squared_chars(self):
     TESTS = [
             (u"\u3301", "alpha"), # combined Alpha in Katakana
             (u"\u3302", "ampere"), # combined Ampere in Katakana 
             (u"\u3304", "inning"),
             (u"\u3306", "won"), # combined Won in Katakana
             (u"\u3307", "escudo"), 
             (u"\u3308", "acre"), # combined Acre in Katakana
             (u"\u3309", "ounce"), # combined ounce in Katakana
             (u"\u330a", "ohm"), # combined Ohm in Katakana
             (u"\u3349", "milli"), # milli in Katakana
             (u"\u3314", "kilo"), # kilo in Katakana
             (u"\u3315", "kilogram"), # kilo gram in Katakana
             (u"\u3316", "kilometer"), # kilo metre in Katakana
             (u"\u3322", "centi"), # centi in Katakana
             (u"\u334d", "meter"), #metre in Katakana
             (u"\u3318", "gram"), # gram in Katakana
             (u"\u3327", "ton"), # ton in Katakana
             (u"\u3303", "are"), # are in Katakana
             (u"\u3336", "hectare"), # hect-are in Katakana
             (u"\u337f", "Inc."), # kabusiki kaisha in Katakana
            ]
     u = Unihandecoder(lang="ja")
     for input, output in TESTS:
         self.failUnlessEqual(u.decode(input), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:27,代码来源:basic_2.py

示例4: test_long_japanese_text

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
    def test_long_japanese_text(self):

        input = "日本国民は、正当に選挙された国会における代表者を通じて行動し、われらとわれらの子孫のために、諸国民との協和による成果と、わが国全土にわたつて自由のもたらす恵沢を確保し、政府の行為によつて再び戦争の惨禍が起ることのないやうにすることを決意し、ここに主権が国民に存することを宣言し、この憲法を確定する。そもそも国政は、国民の厳粛な信託によるものであつて、その権威は国民に由来し、その権力は国民の代表者がこれを行使し、その福利は国民がこれを享受する。これは人類普遍の原理であり、この憲法は、かかる原理に基くものである。われらは、これに反する一切の憲法、法令及び詔勅を排除する。"
        output = "Nihonkokumin ha, Seitou ni Senkyo sareta Kokkai niokeru Daihyousha wo Tsuuji te Koudou shi, wareratowarerano Shison notameni, Shokokumin tono Kyouwa niyoru Seika to, waga Kuni Zendo niwatatsute Jiyuu nomotarasu Keitaku wo Kakuho shi, Seifu no Koui niyotsute Futatabi Sensou no Sanka ga Okoru kotononaiyaunisurukotowo Ketsui shi, kokoni Shuken ga Kokumin ni Sonsu rukotowo Sengen shi, kono Kenpou wo Kakuteisu ru. somosomo Kokusei ha, Kokumin no Genshuku na Shintaku niyorumonodeatsute, sono Ken'i ha Kokumin ni Yurai shi, sono Kenryoku ha Kokumin no Daihyousha gakorewo Koushi shi, sono Fukuri ha Kokumin gakorewo Kyouju suru. koreha Jinruifuhen no Genri deari, kono Kenpou ha, kakaru Genri ni Motozuku monodearu. wareraha, koreni Hansu ru Issai no Kenpou, Hourei Oyobi Shouchoku wo Haijo suru."

        u = Unihandecoder(lang="ja")
        self.assertEqual(u.decode(input), output)
开发者ID:miurahr,项目名称:unihandecode,代码行数:9,代码来源:test_unihandecode_advanced.py

示例5: test_mathematical_digits

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_mathematical_digits(self):
     # 5 consecutive sequences of 0-9
     u = Unihandecoder()
     for n in range(0x1d7ce, 0x1d800):
         a = chr(ord('0') + (n-0x1d7ce) % 10)
         b = u.decode(chr(n))
         
         self.failUnlessEqual(b, a)
开发者ID:Navinum,项目名称:unihandecode,代码行数:10,代码来源:basic_3.py

示例6: test_mac_japanese_pua

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_mac_japanese_pua(self):
     TESTS = [
             ("\uF862\u6709\u9650\u4F1A\u793E",
             "Yuugengaisha"),
                 ]
     u = Unihandecoder(lang="ja")
     for input, output in TESTS:
         self.failUnlessEqual(u.decode(input), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:10,代码来源:basic_3.py

示例7: test_zh

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_zh(self):
     ZHTESTS = [
         ('\u660e\u5929\u660e\u5929\u7684\u98ce\u5439',
          'Ming Tian Ming Tian De Feng Chui ')
         ]
     u = Unihandecoder(lang="zh")
     for instr, output in ZHTESTS:
         self.failUnlessEqual(u.decode(instr), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:10,代码来源:basic_3.py

示例8: test_compatibility_composite

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_compatibility_composite(self):
     TESTS = [
             (u"\ufb01","fi"),
             (u"\u0032\u2075", "25"),
                    ]
     u = Unihandecoder(lang="zh")
     for input, output in TESTS:
         self.failUnlessEqual(u.decode(input), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:10,代码来源:basic_2.py

示例9: test_combining_chars

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_combining_chars(self):
     TESTS = [
             #  roman number "1"  wrapped with solid square 
             (u"\u0031\u20de",    "1"), 
             ]
     u = Unihandecoder(lang="ja")
     for input, output in TESTS:
         self.failUnlessEqual(u.decode(input), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:10,代码来源:basic_2.py

示例10: test_zh

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_zh(self):
     ZHTESTS = [
         (u"\u660e\u5929\u660e\u5929\u7684\u98ce\u5439",
          'Ming Tian Ming Tian De Feng Chui '),
         (u"馮", "Feng "),
         ]
     u = Unihandecoder(lang="zh")
     for input, output in ZHTESTS:
         self.failUnlessEqual(u.decode(input), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:11,代码来源:basic_2.py

示例11: test_decomposed_form

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_decomposed_form(self):
     TESTS = [
             ("\u0041\u0301", "A"),
             ("\u0061\u0323\u0302", "a"),
             ("\u304B\u3099", "ga"),
             ]
     u = Unihandecoder(lang="ja")
     for input, output in TESTS:
         self.failUnlessEqual(u.decode(input), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:11,代码来源:basic_3.py

示例12: test_ja

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_ja(self):
     JATESTS = [
         ('\u660e\u65e5\u306f\u660e\u65e5\u306e\u98a8\u304c\u5439\u304f',
         'Ashita ha Ashita no Kaze ga Fuku'),
         ("\u660e\u5929\u660e\u5929\u7684\u98ce\u5439",
         'Mei Tenmei Ten Teki Sui')
         ]
     u = Unihandecoder(lang="ja")
     for instr, output in JATESTS:
         self.failUnlessEqual(u.decode(instr), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:12,代码来源:basic_3.py

示例13: test_vn

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_vn(self):
     VNTESTS = [
         (u'Ng\xe0y mai gi\xf3 th\u1ed5i v\xe0o ng\xe0y mai',
         'Ngay mai gio thoi vao ngay mai'),
         (u"\u660e\u5929\u660e\u5929\u7684\u98ce\u5439",
         'Minh Tian Minh Tian De Feng Xuy ')
         ]
     u = Unihandecoder(lang="vn")
     for input, output in VNTESTS:
         self.failUnlessEqual(u.decode(input), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:12,代码来源:basic_2.py

示例14: test_decomposed_form

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_decomposed_form(self):
     TESTS = [
             (u"\u0041\u0301", "A"),  # "A" with accent mark 
             (u"\u0061\u0323\u0302", "a"), #  "a" with accent marks
             (u"\u30AB\u3099", "ga"), # "ガ" coded by decomposed from as ' カ゛ '
             (u"\u304B\u3099", "ga"), # "が" coded by decomposed from as ' か゛ '
             ]
     u = Unihandecoder(lang="ja")
     for input, output in TESTS:
         self.failUnlessEqual(u.decode(input), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:12,代码来源:basic_2.py

示例15: test_kr

# 需要导入模块: from unihandecode import Unihandecoder [as 别名]
# 或者: from unihandecode.Unihandecoder import decode [as 别名]
 def test_kr(self):
     KRTESTS = [
         (u'\ub0b4\uc77c\uc740 \ub0b4\uc77c \ubc14\ub78c\uc774 \ubd84\ub2e4',
             'naeileun naeil barami bunda'),
         (u"\u660e\u5929\u660e\u5929\u7684\u98ce\u5439",
          'Myeng Chen Myeng Chen Cek Feng Chwi ')
         ]
     u = Unihandecoder(lang="kr")
     for input, output in KRTESTS:
         self.failUnlessEqual(u.decode(input), output)
开发者ID:Navinum,项目名称:unihandecode,代码行数:12,代码来源:basic_2.py


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