Skip to main content

Japanese word segmentation/POS tagging tool based on neural networks

Project description

![Alt text](/nagisa/data/nagisa_image.jpg 'An image of title')

nagisa: a Japanese tokenizer for NLP beginner

[![Build Status](](

[Japanese (言語処理学会第24回年次大会ワークショップ 形態素解析の今とこれから)](

Nagisa is a python module for Japanese word segmentation/POS-tagging.
It is designed to be a simple and easy-to-use tool.

This tool has the following features.
- Based on recurrent neural networks.
- The word segmentation model uses character- and word-level features [[池田+]](
- The POS-tagging model uses tag dictionary information [[Inoue+]](

<img src='/nagisa/data/models.jpg' width='640px'>

Nagisa is compatible with: Python 2.7-3.6.
This tool uses [DyNet]( (Dynamic Neural Network Toolkit) to calcucate neural networks.

- Using pip
pip install nagisa

- From github
git clone
cd nagisa
python install


import nagisa

# Sample of word segmentation and POS-tagging for Japanese
text = 'Pythonで簡単に使えるツールです'
words = nagisa.tagging(text)
#=> Python/名詞 で/助詞 簡単/形状詞 に/助動詞 使える/動詞 ツール/名詞 です/助動詞

# Get a list of words
#=> ['Python', 'で', '簡単', 'に', '使える', 'ツール', 'です']

# Get a list of POS-tags
#=> ['名詞', '助詞', '形状詞', '助動詞', '動詞', '名詞', '助動詞']


- Output words can be controlled by POS-tags.
# Extarcting all nouns from a text
words = nagisa.extract(text, extract_postags=['名詞'])
#=> Python/名詞 ツール/名詞

# Filtering specific POS-tags from a text
words = nagisa.filter(text, filter_postags=['助詞', '助動詞'])
#=> Python/名詞 簡単/形状詞 使える/動詞 ツール/名詞

# A list of available POS-tags
#=> ['補助記号', '名詞', ... , 'URL']


- A word can be recognized as a single word forcibly.
text = 'ニューラルネットワークを使ってます。'
#=> ニューラル/名詞 ネットワーク/名詞 を/助詞 使っ/動詞 て/助動詞 ます/助動詞 。/補助記号

# If a word is included in the single_word_list, it is recognized as a single word.
tagger_nn = nagisa.Tagger(single_word_list=['ニューラルネットワーク'])
#=> ニューラルネットワーク/名詞 を/助詞 使っ/動詞 て/助動詞 ます/助動詞 。/補助記号

- Nagisa is good at capturing URLs and emoticons from an input text.
text = '(人•ᴗ•♡)こんばんは♪'
words = nagisa.tagging(text)
#=> (人•ᴗ•♡)/補助記号 こんばんは/感動詞 ♪/補助記号

url = 'でコードを公開中(๑¯ω¯๑)'
words = nagisa.tagging(url)
#=> で/助詞 コード/名詞 を/助詞 公開/名詞 中/接尾辞 (๑ ̄ω ̄๑)/補助記号

words = nagisa.filter(url, filter_postags=['URL', '補助記号', '助詞'])
#=> コード/名詞 公開/名詞 中/接尾辞

Project details

Download files

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

Files for nagisa, version 0.0.8
Filename, size File type Python version Upload date Hashes
Filename, size nagisa-0.0.8.tar.gz (20.8 MB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page