Popularity
1.8
Declining
Activity
0.0
Stable
9
1
1

Monthly Downloads: 54
Programming language: Elixir
License: MIT License

exkanji alternatives and similar packages

Based on the "Translations and Internationalizations" category

Do you think we are missing an alternative of exkanji or a related project?

Add another 'Translations and Internationalizations' Package

README

Exkanji

Build Status Hex version Hex downloads Inline docs hex.pm

A Elixir library for translating between hiragana, katakana, romaji, kanji and sound. It uses Mecab.

Installation

If available in Hex, the package can be installed as:

  1. Add exkanji to your list of dependencies in mix.exs:
  def deps do
    [{:exkanji, "~> x.x"}]
  end
  1. Exkanji package needs nkf and mecab command and it needs to install those in your environment when you don't have those.
  $ brew install nkf
  $ brew install mecab mecab-ipadic

Usage

Exkanji provides some convinient functions in Exkanji module through Exkanji.Translator and Exkanji.Mecab. Those provided functions are able to translate into hiragana(ひらがな), katakana(カタカナ), romaji(ローマ字) and sound(五十音).

Into hiragana(ひらがな)

iex(1)> Exkanji.hiragana "a a A ア ア ァ ァ あ ぁ 亜"
"あ あ あ あ あ ぁ ぁ あ ぁ あ"
iex(2)> Exkanji.hiragana "平仮名 ひらがな hiragana"
"ひらがな ひらがな ひらがな"

Into katakana(カタカナ)

iex(3)> Exkanji.katakana "a a A ア ア ァ ァ あ ぁ 亜"
"ア ア ア ア ア ァ ァ ア ァ ア"
iex(4)> Exkanji.katakana "片仮名 かたかな katakana"
"カタカナ カタカナ カタカナ"

Into romaji(ローマ字)

iex(5)> Exkanji.romaji "a a A ア ア ァ ァ あ ぁ 亜"
"a a a a a ァ ァ a ァ a"
iex(6)> Exkanji.romaji "ローマ字 ろーまじ ローマジ"
"ro-maji ro-maji ro-maji"

Into sound(五十音)

iex(7)> Exkanji.sound "よろしく"
"や"
iex(8)> Exkanji.sound "夜露死苦"
"や"

As a Morphological Analyzer.

Exkanji is capable of detecting Part-of-Speech from text, As a Morphological Analyzer. It uses Mecab.

iex(1)> Exkanji.parse "エモい"
{:ok,
 [%Exkanji.Mecab{base: "*", cform: "*", ctype: "*",
   feature: "名詞,一般,*,*,*,*,*", hiragana: nil, pos: "名詞",
   pos1: "一般", pos2: "*", pos3: "*", pron: nil, read: nil, romaji: nil,
   surface: "エモ"},
  %Exkanji.Mecab{base: "いる", cform: "一段", ctype: "連用形",
   feature: "動詞,自立,*,*,一段,連用形,いる,イ,イ", hiragana: nil,
   pos: "動詞", pos1: "自立", pos2: "*", pos3: "*", pron: "イ",
   read: "イ", romaji: nil, surface: "い"}]}

It also makes to change that sets Mecab's dictionaly into second arguments in Exkanji.parse function.

iex(2)> Exkanji.parse "エモい", dict: "/opt/local/lib/mecab/dic/neologd-utf8"
{:ok,
 [%Exkanji.Mecab{base: "エモい", cform: "*", ctype: "*",
   feature: "名詞,固有名詞,一般,*,*,*,エモい,エモイ,エモイ",
   hiragana: nil, pos: "名詞", pos1: "固有名詞", pos2: "一般",
   pos3: "*", pron: "エモイ", read: "エモイ", romaji: nil,
   surface: "エモい"}]}

API Reference.


*Note that all licence references and agreements mentioned in the exkanji README section above are relevant to that project's source code only.