3 unstable releases

0.2.2 Jul 19, 2020
0.2.0 Jul 11, 2020
0.1.1 Jul 8, 2020

#2196 in Development tools

MIT license

7KB
58 lines

pyawabi

pyawabi is a python warapper for awabi(https://github.com/nakagami/awabi).

Requirements

Install

$ pip install setuptools-rust
$ pip install pyawabi

Example

>>> import pyawabi
>>> import pprint
>>> pp = pprint.PrettyPrinter()
>>> pp.pprint(pyawabi.awabi.tokenize("すもももももももものうち"))
[('すもも', '名詞,一般,*,*,*,*,すもも,スモモ,スモモ'),
 ('', '助詞,係助詞,*,*,*,*,,,'),
 ('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
 ('', '助詞,係助詞,*,*,*,*,,,'),
 ('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
 ('', '助詞,連体化,*,*,*,*,,,'),
 ('うち', '名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ')]
>>> pp.pprint(pyawabi.tokenize_n_best("すもももももももものうち", 2))
[[('すもも', '名詞,一般,*,*,*,*,すもも,スモモ,スモモ'),
  ('', '助詞,係助詞,*,*,*,*,,,'),
  ('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
  ('', '助詞,係助詞,*,*,*,*,,,'),
  ('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
  ('', '助詞,連体化,*,*,*,*,,,'),
  ('うち', '名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ')],
 [('すもも', '名詞,一般,*,*,*,*,すもも,スモモ,スモモ'),
  ('', '助詞,係助詞,*,*,*,*,,,'),
  ('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
  ('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
  ('', '助詞,係助詞,*,*,*,*,,,'),
  ('', '助詞,連体化,*,*,*,*,,,'),
  ('うち', '名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ')]]
>>>

Dependencies

~6.5MB
~108K SLoC