% This file shows various usage of this parser

\input luaotfload.sty % otf font loader
\input kanaparser % load the parser package

\font\jp = ipagp % ipagp.otf font is included in the ipafont font package: https://www.internationalphoneticassociation.org/content/ipa-fonts

\parserInit % initialize kana parser

% wrapper macros that change font automatically
\def\jchar#1{{\jp #1}}
\def\kpth#1{\jchar{\toHiragana{#1}}}
\def\kptk#1{\jchar{\toKatakana{#1}}}
\def\kptl#1{\jchar{\toLatin{#1}}}

Example of transliteration to Latin: \kptl{しゅんかしゅうとう しし}

Example of transliteration to katakana featuring prolongation dashes: \kptk{しゅんかしゅうとう しし}

Example of transliteration to hiragana converting prolongation dashes: \kpth{シュンカシュートー}

Example of transliteration of multiple-form syllables to hiragana using default settings: \kpth{jiji wewe}

\toggleChars{ji we} % toggles the kana representation of 'ji' and 'we' syllables
Example of transliteration of multiple-form syllables to hiragana using alternate settings: \kpth{jiji wewe}

Mixed example of transliteration to katakana: \kptk{shunkashuutouuuxxxxxchou}

Example of default transliteration to hiragana using ambiguous syllables after n: \kpth{renyoukei}

Example of isolated n-character to resolve ambiguity: \kpth{ren'youkkei}

Example of hiragana to Latin transliteration from previous example: \kptl{れんようけい}

Example of consonant gemination from hiragana to Latin: \kptl{にっぽん}

Example of consonant gemination from Latin to hiragana: \kpth{nippon}

Example of character preservation: \kptl{when transLating to Latin, ' and " are preserved}

Example of character preservation 2: \kptl{\kpth{when transLating to kana, ' is consumed, " is preserved}}

\bye
