- Notifications
You must be signed in to change notification settings - Fork10
Sentence boundary disambiguation tool for Japanese texts (日本語文境界判定器)
License
megagonlabs/bunkai
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Bunkai is a sentence boundary (SB) disambiguation tool for Japanese texts.
Bunkaiは日本語文境界判定器です.
$pip install -U bunkai
$echo -e'宿を予約しました♪!まだ2ヶ月も先だけど。早すぎかな(笑)楽しみです★\n2文書目の先頭行です。▁改行はU+2581で表現します。' \ | bunkai宿を予約しました♪!│まだ2ヶ月も先だけど。│早すぎかな(笑)│楽しみです★2文書目の先頭行です。▁│改行はU+2581で表現します。
- Feed a document as one line by using
▁
(U+2581) for line breaks.
1行は1つの文書を表します.文書中の改行は▁
(U+2581) で与えてください. - The output shows sentence boundaries with
│
(U+2502).
出力では文境界は│
(U+2502) で表示されます.
If you want to disambiguate sentence boundaries for line breaks, please add a--model
option with the path to the model.
改行記号に対しても文境界判定を行いたい場合は,--model
オプションを与える必要があります.
First, please install extras to use--model
option.--model
オプションを利用するために、まずextraパッケージをインストールしてください.
$pip install -U'bunkai[lb]'
Second, please setup a model. It will take some time.
次にモデルをセットアップする必要があります.セットアップには少々時間がかかります.
$bunkai --model bunkai-model-directory --setup
Then, please designate the directory.
そしてモデルを指定して動かしてください.
$echo -e"文の途中で改行を▁入れる文章ってありますよね▁それも対象です。"| bunkai --model bunkai-model-directory文の途中で改行を▁入れる文章ってありますよね▁│それも対象です。
You can get morphological analysis results with--ma
option.--ma
オプションを付与すると形態素解析結果が得られます.
It can be used with the--model
option.--model
オプションと同時に使えます.
$echo -e'形態素解析し▁ます。結果を 表示します!'| bunkai --ma --model bunkai-model-directory形態素名詞,一般,*,*,*,*,形態素,ケイタイソ,ケイタイソ解析名詞,サ変接続,*,*,*,*,解析,カイセキ,カイセキし動詞,自立,*,*,サ変・スル,連用形,する,シ,シ▁ます助動詞,*,*,*,特殊・マス,基本形,ます,マス,マス。記号,句点,*,*,*,*,。,。,。EOS結果名詞,副詞可能,*,*,*,*,結果,ケッカ,ケッカを助詞,格助詞,一般,*,*,*,を,ヲ,ヲ 記号,空白,*,*,*,*, ,*,*表示名詞,サ変接続,*,*,*,*,表示,ヒョウジ,ヒョージし動詞,自立,*,*,サ変・スル,連用形,する,シ,シます助動詞,*,*,*,特殊・マス,基本形,ます,マス,マス!記号,一般,*,*,*,*,!,!,!EOS
You can also use Bunkai as Python library.
BunkaiはPythonライブラリとしても使えます.
frombunkaiimportBunkaibunkai=Bunkai()forsentenceinbunkai("はい。このようにpythonライブラリとしても使えます!"):print(sentence)
改行を文境界判定に含める場合はセットアップしたモデルパスを指定してください.
If you want to disambiguate line breaks too, please designate the model path where you set up.
frompathlibimportPathfrombunkaiimportBunkaibunkai=Bunkai(path_model=Path("bunkai-model-directory"))forsentenceinbunkai("そうなんです▁このように▁pythonライブラリとしても▁使えます!"):print(sentence)"""Output:そうなんです▁このように▁pythonライブラリとしても▁使えます!"""
For more information, seeexamples.
ほかの例はexamplesをご覧ください.
- Yuta Hayashibe and Kensuke Mitsuzawa.Sentence Boundary Detection on Line Breaks in Japanese.Proceedings of The 6th Workshop on Noisy User-generated Text (W-NUT 2020), pp.71-75.November 2020.[PDF][bib]
Apache License 2.0
About
Sentence boundary disambiguation tool for Japanese texts (日本語文境界判定器)
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.