Function Repository Resource:

ToKatakana

Source Notebook

Convert any hiragana characters in a string to katakana

Contributed by: Jan Mangaldan

ResourceFunction["ToKatakana"][string]

yields a string in which all hiragana characters have been converted to katakana.

Details

Katakana (片仮名, カタカナ) is a Japanese syllabary, one component of the Japanese writing system, along with hiragana, kanji and, in some cases, rōmaji (Latin script).
ResourceFunction["ToKatakana"] handles both unvoiced and voiced versions of kana characters.
Kanji and Roman letters are left untouched.
ResourceFunction["ToKatakana"] automatically threads over lists.

Examples

Basic Examples (1) 

Convert the first line of the Iroha:

In[1]:=
ResourceFunction["ToKatakana"]["いろはにほへと"]
Out[1]=

Scope (2) 

Convert a list of hiragana strings:

In[2]:=
ResourceFunction["ToKatakana"][{"いろはにほへと", "ちりぬるを"}]
Out[2]=

Non-hiragana characters are not converted:

In[3]:=
ResourceFunction["ToKatakana"]["色は匂えど"]
Out[3]=
In[4]:=
ResourceFunction["ToKatakana"]["頭カラッポの方が 夢詰め込める"]
Out[4]=

Applications (1) 

Generate the katakana syllabary from the hiragana syllabary:

In[5]:=
ResourceFunction["ToKatakana"][Alphabet["Hiragana"]]
Out[5]=

Properties and Relations (1) 

The functions ToKatakana and ToHiragana are inverses of each other:

In[6]:=
ResourceFunction["ToKatakana"]["どんぐりころころ"]
Out[6]=
In[7]:=
ResourceFunction["ToHiragana"][%]
Out[7]=

Requirements

Wolfram Language 12.3 (May 2021) or above

Version History

  • 1.0.0 – 20 March 2024

Related Resources

License Information