Skip to main content

Japanese text normalizer for mecab-neologd

Project description

neologdn pyversion latest version Code Health license

neologdn is a Japanese text normalizer for mecab-neologd.

The normalization is based on the neologd’s rules:

Contributions are welcome!

NOTE: Installing this module requires C++11 compiler.


$ pip install neologdn


import neologdn
# => 'ハンカクカナ'
# => '全角記号!?@#'
# => '全角記号例外「・」'
# => '長音短縮ウェーイ'
# => 'チルダ削除ウェイ'
# => 'いろんなハイフン-'
neologdn.normalize("   PRML  副 読 本   ")
# => 'PRML副読本'
neologdn.normalize(" Natural Language Processing ")
# => 'Natural Language Processing'
neologdn.normalize("かわいいいいいいいいい", repeat=6)
# => 'かわいいいいいい'
neologdn.normalize("無駄無駄無駄無駄ァ", repeat=1)
# => '無駄ァ'


# Sample code from
import normalize_neologd

%timeit normalize(normalize_neologd.normalize_neologd)
# => 1 loop, best of 3: 18.3 s per loop

import neologdn
%timeit normalize(neologdn.normalize)
# => 1 loop, best of 3: 9.05 s per loop

neologdn is about x2 faster than sample code.

details are described as the below notebook:


Apache Software License.


0.4 (2018-12-06)

  • Add shorten_repeat function, which shortening contiguous substring. For example: neologdn.normalize(“無駄無駄無駄無駄ァ”, repeat=1) -> 無駄ァ

0.3.2 (2018-05-17)

  • Add option for suppression removal of spaces between Japanese characters

0.2.2 (2018-03-10)

  • Fix bug (daku-ten & handaku-ten)
  • Support mac osx 10.13 (Many thanks @r9y9)

0.2.1 (2017-01-23)

  • Fix bug (Check if a previous character of daku-ten character is in maps) (Many thanks @unnonouno)

0.2 (2016-04-12)

  • Add lengthened expression (repeating character) threshold

0.1.2 (2016-03-29)

  • Fix installation bug (2016-03-19)

  • Support Windows
  • Explicitly specify to -std=c++11 in build (Many thanks @id774)

0.1.1 (2015-10-10)

Initial release.

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 neologdn, version 0.4
Filename, size & hash File type Python version Upload date
neologdn-0.4-cp27-cp27m-win32.whl (38.5 kB) View hashes Wheel cp27
neologdn-0.4-cp27-cp27m-win_amd64.whl (44.5 kB) View hashes Wheel cp27
neologdn-0.4-cp36-cp36m-macosx_10_12_x86_64.whl (57.5 kB) View hashes Wheel cp36
neologdn-0.4-cp36-cp36m-win32.whl (46.6 kB) View hashes Wheel cp36
neologdn-0.4-cp36-cp36m-win_amd64.whl (53.5 kB) View hashes Wheel cp36
neologdn-0.4-cp37-cp37m-macosx_10_13_x86_64.whl (55.2 kB) View hashes Wheel cp37
neologdn-0.4-cp37-cp37m-win32.whl (45.9 kB) View hashes Wheel cp37
neologdn-0.4-cp37-cp37m-win_amd64.whl (52.9 kB) View hashes Wheel cp37
neologdn-0.4.tar.gz (59.2 kB) View hashes Source None

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