Package: example990420
台文 | Tâi-bûnTaiwanese Hokkien transliterator from Chinese charactersIt has methods that allow to customise transliteration and retrieve any necessary information about Taiwanese Hokkien pronunciation.Includes word tokeniser for Taiwanese Hokkien.Report Bug•PyPITable of Contents<li><a href="#install">Install</a></li>

<li>

  <a href="#usage">Usage</a>

  <ul>

    <li>

      <a href="#converter">Converter</a>

      <ul>

        <li><a href="#system">System</a></li>

        <li><a href="#dialect">Dialect</a></li>

        <li><a href="#format">Format</a></li>

        <li><a href="#delimiter">Delimiter</a></li>

        <li><a href="#sandhi">Sandhi</a></li>

        <li><a href="#punctuation">Punctuation</a></li>

      </ul>

    </li>

    <li><a href="#tokeniser">Tokeniser</a></li>

  </ul>

</li>

<li><a href="#example">Example</a></li>

<li><a href="#data">Data</a></li>

<li><a href="#licence">Licence</a></li>InstallTaibun can be installed frompypi$pipinstalltaibunUsageConverterConverterclass transliterates the Chinese characters to the chosen transliteration system with parameters specified by the developer. Works for both Traditional and Simplified characters.# constructorc=Converter(system,dialect,format,delimiter,sandhi,punctuation)# transliterate Chinese charactersc.get(input)# convert Simplified Chinese characters to Traditional Chinese Charactersc.to_traditional(input)SystemsystemString - system of transliteration.Tailo(default) -Tâi-uân Lô-má-jī Phing-im Hong-ànPOJ-Pe̍h-ōe-jīZhuyin-Taiwanese Phonetic SymbolsTLPA-Taiwanese Language Phonetic AlphabetPingyim-Bbánlám Uē Pìngyīm Hōng'ànTongiong-Daī-ghî Tōng-iōng Pīng-im| text | Tailo   | POJ     | Zhuyin      | TLPA      | Pingyim | Tongiong ||------|---------|---------|-------------|-----------|---------|----------|| 臺灣 | Tâi-uân | Tâi-oân | ㄉㄞˊ ㄨㄢˊ | Tai5 uan5 | Dáiwán  | Tāi-uǎn  |DialectdialectString - preferred pronunciation.south(default) -Zhangzhou-leaning pronunciationnorth-Quanzhou-leaning pronunciation| text   | south         | north         ||--------|---------------|---------------|| 五月節 | Gōo-gue̍h-tseh | Gōo-ge̍h-tsueh |FormatformatString - format in which tones will be represented in the converted sentence.mark(default) - uses diacritics for each syllable. Not available for TLPA.number- add a number which represents the tone at the end of the syllablestrip- removes any tone marking| text | mark    | number    | strip   ||------|---------|-----------|---------|| 臺灣 | Tâi-uân | Tai5-uan5 | Tai-uan |DelimiterdelimiterString - sets the delimiter character that will be placed in between syllables of a word.Default value depends on the chosensystem:'-'- forTailo,POJ,Tongiong''- forPingyim' '- forZhuyin,TLPA| text | '-'     | ''     | ' '     ||------|---------|--------|---------|| 臺灣 | Tâi-uân | Tâiuân | Tâi uân |SandhisandhiBoolean - applies thesandhi rules of Taiwanese Hokkiento syllables of a single word.Default value depends on the chosensystem:True- forTongiongFalse- forTailo,POJ,Zhuyin,TLPA,Pingyim| text     | False        | True         ||----------|--------------|--------------|| 育囡仔歌 | Io-gín-á-kua | Iō-gin-a-kua |Sandhi rules also change depending on the dialect chosen.| text | no sandhi | south   | north   ||------|-----------|---------|---------|| 臺灣 | Tâi-uân   | Tāi-uân | Tài-uân |Note that the function is different from real sandhi rules, where changes are applied to every single syllable of the sentence, not just single words.Taibun's sandhi rules: Thái-khong pīng-iú, lín hó! Lín tsià-pá buē?Actual sandhi rules: Thái-khōng pīng-iú, lin hó! Lin tsià-pa buē?PunctuationpunctuationStringformat(default) - converts Chinese-style punctuation to Latin-style punctuation and capitalises words at the beginning of each sentence.none- preserves Chinese-style punctuation and doesn't capitalise words at the beginning of new sentences.| text | format | none ||-|-|-|| 這是臺南，簡稱「南」（白話字：Tâi-lâm；注音符號：ㄊㄞˊ ㄋㄢˊ，國語：Táinán）。 | Tse sī Tâi-lâm, kán-tshing "lâm" (Pe̍h-uē-jī: Tâi-lâm; tsù-im hû-hō: ㄊㄞˊ ㄋㄢˊ, kok-gí: Táinán). | tse sī Tâi-lâm，kán-tshing「lâm」（Pe̍h-uē-jī：Tâi-lâm；tsù-im hû-hō：ㄊㄞˊ ㄋㄢˊ，kok-gí：Táinán）。 |TokeniserTokeniserclass performsNLTK wordpunct_tokenize-like tokenisation of a Taiwanese Hokkien sentence.# constructort=Tokeniser()# tokenise Taiwanese Hokkien sentencet.tokenise(input)ExamplefromtaibunimportConverter,Tokeniser# Systemc=Converter()# Tailo system defaultc.get('先生講，學生恬恬聽。')>>Sian-sinnkóng,ha̍k-singtiām-tiāmthiann.c=Converter(system='Zhuyin')c.get('先生講，學生恬恬聽。')>>ㄒㄧㄢㄒㆪㄍㆲˋ,ㄏㄚㄍㄒㄧㄥㄉㄧㆰ˫ㄉㄧㆰ˫ㄊㄧㆩ.# Dialectc=Converter()# south dialect defaultc.get("我欲用箸食魚")>>Guábehīngtītsia̍hhîc=Converter(dialect='north')c.get("我欲用箸食魚")>>Guábuehīngtūtsia̍hhû# Formatc=Converter()# for Tailo, mark by defaultc.get("生日快樂")>>Senn-ji̍tkhuài-lo̍kc=Converter(format='number')c.get("生日快樂")>>Senn1-jit8khuai3-lok8c=Converter(format='strip')c.get("生日快樂")>>Senn-jitkhuai-lok# Delimiterc=Converter(delimiter='')c.get("先生講，學生恬恬聽。")>>Siansinnkóng,ha̍ksingtiāmtiāmthiann.c=Converter(system='Pingyim',delimiter='-')c.get("先生講，學生恬恬聽。")>>Siān-snīgǒng,hág-sīngdiâm-diâmtinā.# Sandhic=Converter()# for Tailo, sandhi False by defaultc.get("南迴鐵路")>>Lâm-huê-thih-lōoc=Converter(sandhi=True)c.get("南迴鐵路")>>Lām-huē-thí-lōo# Punctuationc=Converter()# format punctuation defaultc.get("太空朋友，恁好！恁食飽未？")>>Thài-khongpîng-iú,línhó!Líntsia̍h-pábuē?c=Converter(punctuation='none')c.get("太空朋友，恁好！恁食飽未？")>>thài-khongpîng-iú，línhó！líntsia̍h-pábuē？# Tokenisert=Tokeniser()t.tokenise("太空朋友，恁好！恁食飽未？")>>['太空','朋友','，','恁','好','！','恁','食飽','未','？']DataDictionary of Frequently-Used Taiwan Minnan(viamoedict-data-twblg)LicenceBecause Taibun is MIT-licensed, any developer can essentially do whatever they want with it as long as they include the original copyright and licence notice in any copies of the source code. Note, that the data used by the package is licensed under a different copyright.The data is licensed underCC BY-ND 3.0 TW