當前位置: 首頁>>代碼示例>>Python>>正文


Python unihandecode.Unihandecoder類代碼示例

本文整理匯總了Python中unihandecode.Unihandecoder的典型用法代碼示例。如果您正苦於以下問題:Python Unihandecoder類的具體用法?Python Unihandecoder怎麽用?Python Unihandecoder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Unihandecoder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_combining_chars

 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,代碼行數:7,代碼來源:basic_3.py

示例2: test_squared_chars

 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,代碼行數:25,代碼來源:basic_2.py

示例3: test_long_japanese_text

    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,代碼行數:7,代碼來源:test_unihandecode_advanced.py

示例4: test_zh

 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,代碼行數:8,代碼來源:basic_3.py

示例5: test_mac_japanese_pua

 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,代碼行數:8,代碼來源:basic_3.py

示例6: test_compatibility_composite

 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,代碼行數:8,代碼來源:basic_2.py

示例7: test_combining_chars

 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,代碼行數:8,代碼來源:basic_2.py

示例8: test_mathematical_digits

 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,代碼行數:8,代碼來源:basic_3.py

示例9: test_decomposed_form

 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,代碼行數:9,代碼來源:basic_3.py

示例10: test_kana

 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,代碼行數:9,代碼來源:basic_2.py

示例11: test_zh

 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,代碼行數:9,代碼來源:basic_2.py

示例12: test_ja

 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,代碼行數:10,代碼來源:basic_3.py

示例13: test_vn

 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,代碼行數:10,代碼來源:basic_2.py

示例14: test_zh

 def test_zh(self):
     ZHTESTS = [
         ("\u3400", 'Qiu '),
         ("\u660e\u5929\u660e\u5929\u7684\u98ce\u5439",
          'Ming Tian Ming Tian De Feng Chui '),
         ("馮", "Feng "),
         ]
     u = Unihandecoder(lang="zh")
     for input, output in ZHTESTS:
         self.assertEqual(u.decode(input), output)
開發者ID:miurahr,項目名稱:unihandecode,代碼行數:10,代碼來源:test_unihandecode.py

示例15: test_kr

 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,代碼行數:10,代碼來源:basic_2.py


注:本文中的unihandecode.Unihandecoder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。