Skip to main content

Extract phases in Japanese text using rules.

Project description

Negima

Extract phases in Japanese text using rules.

Installing

Install and update using setup.py:

$ python setup.py install

Dependencies

A Simple Example

sample.py

from negima import MorphemeMerger
mm = MorphemeMerger()
mm.set_rule_from_csv('rules/1_noun.csv')

words, posses = mm.get_rule_pattern('今日はいい天気')
print(words)
$ python sample.py
  ['今日', '天気']

Rule samples

rule/1_noun.csv

Extract nouns.

  • 約5000人が国立競技場に駆けつけた -> 5000 国立 競技
  • 場所がわかりにくいのでたどり着けなかった -> 場所

rule/2_nouns.csv

Extract compound nouns.

  • 約5000人が国立競技場に駆けつけた -> 約5000人 国立競技場
  • 場所がわかりにくいのでたどり着けなかった -> 場所

rule/3_independence_phase.csv

  • 新人研修のレベルは高い -> 新人研修 レベルは高い
  • あのサイトはホテルの比較がしやすくないので好きではない -> サイト ホテル 比較がしやすくない 好きではない

test

$ pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

negima-0.1.1.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

negima-0.1.1-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page