How to use the pykakasi.kakasi function in pykakasi

To help you get started, we’ve selected a few pykakasi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github miurahr / pykakasi / tests / test_pykakasi.py View on Github external
def test_kakasi_long_symbol_H():
    TESTS = [
        (u'γ‚„γ£γŸγƒΌ', u'yattaa'),
        (u'でっでー', u'deddee'),
        (u'てんさーちろー', u'tensaafuroo'),
        (u'γŒγ£γŒγƒΌγ‚“', u'gaggaan'),
        (u'どーん', u'doon')
    ]

    kakasi = pykakasi.kakasi()
    kakasi.setMode('H', 'a')
    converter = kakasi.getConverter()
    for case, result in TESTS:
        print(converter.do(case))
        assert converter.do(case) == result
github miurahr / pykakasi / tests / test_pykakasi_issues.py View on Github external
def test_issues60():
    TESTS = [
        (u"εΈ‚η«‹", u"γ—γ‚Šγ€")
    ]
    kakasi = pykakasi.kakasi()
    kakasi.setMode("H", None)
    kakasi.setMode("K", None)
    kakasi.setMode("J", "H")
    kakasi.setMode("s", False)
    kakasi.setMode("C", True)
    kakasi.setMode("E", None)
    kakasi.setMode("a", None)
    converter = kakasi.getConverter()
    for case, result in TESTS:
        assert converter.do(case) == result
github miurahr / pykakasi / tests / test_pykakasi.py View on Github external
def test_kakasi_E2a_upper():
    TESTS = [
        (u"ο½ο½‚ο½ƒο½„ο½…ο½†ο½‡ο½ˆο½‰ο½Šο½‹ο½Œο½ο½Žο½ο½ο½‘ο½’ο½“ο½”ο½•ο½–ο½—ο½˜ο½™ο½š", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"),
    ]
    kakasi = pykakasi.kakasi()
    kakasi.setMode("E", "a")
    kakasi.setMode("U", True)
    converter = kakasi.getConverter()
    for case, result in TESTS:
        assert converter.do(case) == result
github miurahr / pykakasi / tests / basic_3.py View on Github external
TESTS = [
            ("ζ§‹ζˆ",         "Kousei"),
            ("ε₯½γ",         "Suki"),
            ("倧きい",       "Ookii"),
            ("γ‹γ‚“γŸγ‚“",     "kantan"),
            ("にゃ",         "nya"),
            ("っき",         "kki"),
            ("っちぁ",       "ffa"),
            ("ζΌ’ε­—γ¨γ²γ‚‰γŒγͺδΊ€γ˜γ‚Šζ–‡", "Kanzi tohiragana Maziri Bun"),
            ("Alphabet 123 and ζΌ’ε­—", "Alphabet 123 and Kanzi"),
            ("ζ—₯η΅Œζ–°θž", "Nikkeisinbun"),
            ("ζ—₯ζœ¬ε›½ζ°‘γ―γ€","Nihonkokumin ha,")
        ]

        kakasi = pykakasi.kakasi()
        kakasi.setMode("H","a")
        kakasi.setMode("K","a")
        kakasi.setMode("J","a")
        kakasi.setMode("r","Kunrei")
        kakasi.setMode("C",True)
        kakasi.setMode("s",True)
        kakasi.setMode("E","a")
        converter  = kakasi.getConverter()
        for case, result in TESTS:
            self.assertEqual(converter.do(case), result)
github miurahr / pykakasi / tests / test_pykakasi.py View on Github external
TESTS = [
        (u"", ""),
        (u"ζ§‹ζˆ", "Kousei"),
        (u"ε₯½γ", "Suki"),
        (u"倧きい", "Ookii"),
        (u"γ‹γ‚“γŸγ‚“", "kantan"),
        (u"にゃ", "nya"),
        (u"っき", "kki"),
        (u"っちぁ", "ffa"),
        (u"ζΌ’ε­—γ¨γ²γ‚‰γŒγͺδΊ€γ˜γ‚Šζ–‡", "Kanzi tohiragana Maziri Bun"),
        (u"Alphabet 123 and ζΌ’ε­—", "Alphabet 123 and Kanzi"),
        (u"ζ—₯η΅Œζ–°θž", "Nikkeisinbun"),
        (u"ζ—₯ζœ¬ε›½ζ°‘γ―γ€", "Nihonkokumin ha,")
    ]

    kakasi = pykakasi.kakasi()
    kakasi.setMode("H", "a")
    kakasi.setMode("K", "a")
    kakasi.setMode("J", "a")
    kakasi.setMode("r", "Kunrei")
    kakasi.setMode("E", "a")
    kakasi.setMode("s", True)
    kakasi.setMode("a", None)
    kakasi.setMode("C", True)
    converter = kakasi.getConverter()
    for case, result in TESTS:
        assert converter.do(case) == result
github miurahr / pykakasi / tests / test_pykakasi_issues.py View on Github external
def test_issues59():
    TESTS = [
        (u"γ˜γ‚ƒγƒΌγ‚“", u"γ˜γ‚ƒγƒΌγ‚“"),
        (u"γƒ·γƒΈγƒΉγƒΊ", u"γƒ·γƒΈγƒΉγƒΊ")
    ]
    kakasi = pykakasi.kakasi()
    kakasi.setMode("H", None)
    kakasi.setMode("K", "H")
    kakasi.setMode("J", None)
    kakasi.setMode("s", False)
    kakasi.setMode("C", True)
    kakasi.setMode("E", None)
    kakasi.setMode("a", None)
    converter = kakasi.getConverter()
    for case, result in TESTS:
        assert converter.do(case) == result
github miurahr / pykakasi / tests / test_pykakasi.py View on Github external
def test_kakasi_passport_specialcase():

    TESTS = [
        (u"γˆγ£γ‘γ‚…γ†", "etchu"),
        (u"はっけょう", "hatcho"),
        (u"エッチγƒ₯ウ", "etchu"),
        (u"ハッチョウ", "hatcho")
    ]
    kakasi = pykakasi.kakasi()
    kakasi.setMode("H", "a")
    kakasi.setMode("K", "a")
    kakasi.setMode("J", "a")
    kakasi.setMode("r", "Passport")
    kakasi.setMode("E", "a")
    kakasi.setMode("a", None)
    converter = kakasi.getConverter()
    for case, result in TESTS:
        assert converter.do(case) == result
github miurahr / pykakasi / tests / test_exceptions.py View on Github external
def test_kakasi_unknown_mode():
    with pytest.raises(InvalidModeValueException):
        kakasi = pykakasi.kakasi()
        kakasi.setMode("H", "a")
        kakasi.setMode("K", "a")
        kakasi.setMode("J", "X")
github julesontheroad / NSC_BUILDER / py / ztools / Fs / ChromeNacp.py View on Github external
if i == 2:					
						kakasi = pykakasi.kakasi()
						kakasi.setMode("H", "a")
						kakasi.setMode("K", "a")
						kakasi.setMode("J", "a")
						kakasi.setMode("s", True)
						kakasi.setMode("E", "a")
						kakasi.setMode("a", None)
						kakasi.setMode("C", False)
						converter = kakasi.getConverter()
						title=converter.do(title)	
						title=title[0].upper()+title[1:]
						editor=converter.do(editor)		
						editor=editor[0].upper()+editor[1:]		
					if i == 14 or i == 13 or i==12:					
						kakasi = pykakasi.kakasi()
						kakasi.setMode("H", "a")
						kakasi.setMode("K", "a")
						kakasi.setMode("J", "a")
						kakasi.setMode("s", True)
						kakasi.setMode("E", "a")
						kakasi.setMode("a", None)
						kakasi.setMode("C", False)	
						
				message=("Language: "+str(NacpLanguageType(i)).replace('NacpLanguageType.', ''));feed=self.html_feed(feed,6,message)		
				
				feed+='<ul style="margin-bottom: 2px;margin-top: 3px">'
				message=["Name:",title];feed=self.html_feed(feed,3,message)			
				message=["Publisher:",editor];feed=self.html_feed(feed,3,message)
				feed+='</ul>'						
		return feed
github julesontheroad / NSC_BUILDER / py / ztools / Fs / Nacp.py View on Github external
if i == 2:					
						kakasi = pykakasi.kakasi()
						kakasi.setMode("H", "a")
						kakasi.setMode("K", "a")
						kakasi.setMode("J", "a")
						kakasi.setMode("s", True)
						kakasi.setMode("E", "a")
						kakasi.setMode("a", None)
						kakasi.setMode("C", False)
						converter = kakasi.getConverter()
						title=converter.do(title)	
						title=title[0].upper()+title[1:]
						editor=converter.do(editor)		
						editor=editor[0].upper()+editor[1:]		
					if i == 14 or i == 13 or i==12:					
						kakasi = pykakasi.kakasi()
						kakasi.setMode("H", "a")
						kakasi.setMode("K", "a")
						kakasi.setMode("J", "a")
						kakasi.setMode("s", True)
						kakasi.setMode("E", "a")
						kakasi.setMode("a", None)
						kakasi.setMode("C", False)	
				if gui==True:					
					message=('...............................');print(message);feed+=message+'...............................'*2+'\n'	
					message=('Language: '+ str(NacpLanguageType(i)).replace('NacpLanguageType.', ''));print(message);feed+=message+'\n'				
					message=('...............................');print(message);feed+=message+'...............................'*2+'\n'						
					message=('- Name: '+ title);print(message);feed+=message+'\n'					
					message=('- Publisher: '+ editor);print(message);feed+=message+'\n'
				else:
					message=('...............................');print(message);feed+=message+'\n'		
					message=('Language: '+ str(NacpLanguageType(i)).replace('NacpLanguageType.', ''));print(message);feed+=message+'\n'