Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

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

License

NotificationsYou must be signed in to change notification settings

ikeikeikeike/exkanji

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusHex versionHex downloadsInline docshex.pm

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

Installation

Ifavailable in Hex, the package can be installed as:

  1. Add exkanji to your list of dependencies inmix.exs:
defdepsdo[{:exkanji,"~> x.x"}]end
  1. Exkanji package needsnkf andmecab 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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp