def test_romanization_royin(self): engine = 'royin' self.assertEqual(romanization('แมว', engine=engine), 'maeo') self.assertEqual(romanization('เดือน', engine=engine), 'duean') self.assertEqual(romanization('ดู', engine=engine), 'du') self.assertEqual(romanization('ดำ', engine=engine), 'dam') self.assertEqual(romanization('บัว', engine=engine), 'bua')
def word_tokenize_to_g2p(text): wordall = dict_word_tokenize(text, custom_dict_trie=DEFAULT_DICT_TRIE) list = [] for a in wordall: try: list.append(data[a]) #romanization(a,engine='pyicu')) except: word_list_icu = word_tokenize(a, engine="icu") for b in word_list_icu: list.append(romanization(b, engine='pyicu')) return '|'.join(list)
def romanize(value): name = '' try: name = romanization(value) except: try: name = self.google_tha_to_eng(value) except: pass return utils.keep_english_letters(name.title())
def thai_transcript(inpstr): from pythainlp.romanization import romanization from pythainlp.tokenize import word_tokenize stlist = split_by_alphabet(inpstr) latin = '' for st in stlist: if (unicodedata.name(st[0]).split(' ')[0] == 'THAI'): transcript = [] for w in word_tokenize(st): transcript.append(romanization(w, engine='royin')) latin = latin + ' '.join(transcript) else: latin = latin + st return (latin)
# -*- coding: utf-8 -*- from pythainlp.romanization import romanization print(romanization("แมว"))
def testRomanization(self): self.assertEqual(romanization("แมว"),'mæw')
from __future__ import absolute_import from __future__ import division from __future__ import print_function from pythainlp.segment import segment a = 'ฉันรักภาษาไทยเพราะฉันเป็นคนไทย' b = segment(a) print(b) from pythainlp.segment.dict import segment print(segment(a)) print(type(b)) from pythainlp.rank import rank aa = rank(b) print(aa) from pythainlp.romanization import romanization b=romanization("แมว") print(b) from pythainlp.change import * a="l;ylfu8iy[" a=texttothai(a) b="นามรสนอำันี" b=texttoeng(b) print(a) print(b) from pythainlp.segment.dict import segment print(segment('ปีคริสต์ศักราช')) from pythainlp.number import numtowords print("5611116.50") print(numtowords(5611116.50)) from pythainlp.postaggers import tag
from pythainlp.segment import segment a = 'ฉันรักภาษาไทยเพราะฉันเป็นคนไทย' b = segment(a) print(b) from pythainlp.segment.dict import segment print(segment(a)) print(type(b)) from pythainlp.rank import rank aa = rank(a) print(aa) from pythainlp.romanization import romanization b=romanization("ต้นกก") print(b) from pythainlp.change import * a="l;ylfu8iy[" a=texttothai(a) b="นามรสนอำันี" b=texttoeng(b) print(a) print(b) from pythainlp.segment.dict import segment print(segment('ฉันรักคุณ')) from pythainlp.number import numtowords print("5611116.50") print(numtowords(5611116.50))
from __future__ import absolute_import from __future__ import division from __future__ import print_function from pythainlp.segment import segment a = 'ฉันรักภาษาไทยเพราะฉันเป็นคนไทย' b = segment(a) print(b) from pythainlp.segment.dict import segment print(segment(a)) print(type(b)) from pythainlp.rank import rank aa = rank(b) print(aa) from pythainlp.romanization import romanization b = romanization("แมว") print(b) from pythainlp.change import * a = "l;ylfu8iy[" a = texttothai(a) b = "นามรสนอำันี" b = texttoeng(b) print(a) print(b) from pythainlp.segment.dict import segment print(segment('ปีคริสต์ศักราช')) from pythainlp.number import numtowords print("5611116.50") print(numtowords(5611116.50)) from pythainlp.postaggers import tag
def test_romanization2(self): self.assertEqual(romanization("แมว",engine="royin"),'maeo')
def test_romanization_royin(self): self.assertEqual(romanization("แมว", engine="royin"), 'maeo') self.assertEqual(romanization("เดือน", engine="royin"), 'duean') self.assertEqual(romanization("ดู", engine="royin"), 'du') self.assertEqual(romanization("ดำ", engine="royin"), 'dam') self.assertEqual(romanization("บัว", engine="royin"), 'bua')
def test_romanization(self): self.assertEqual(romanization("แมว"), 'maeo') self.assertEqual(romanization("แมว", "pyicu"), 'mæw')
def test_romanization(self): self.assertEqual(romanization('แมว'), 'maeo') self.assertEqual(romanization('แมว', 'pyicu'), 'mæw')
def test_romanization_royin(self): self.assertEqual(romanization("แมว",engine="royin"),'maeo') self.assertEqual(romanization("เดือน",engine="royin"),'duean') self.assertEqual(romanization("ดู",engine="royin"),'du') self.assertEqual(romanization("ดำ",engine="royin"),'dam') self.assertEqual(romanization("บัว",engine="royin"),'bua')
def test_romanization(self): self.assertEqual(romanization("แมว"),'maeo') self.assertEqual(romanization("แมว","pyicu"),'mæw')