github.com/rarnu/crystalmoji
0.1.0 / published Nov 10, 2025 / repository
Crystal porting for Kuromoji
crystalmoji
CrystalMoji is a Crystal porting for Kuromoji.
Kuromoji is an easy to use and self-contained Japanese morphological analyzer that does
Word segmentation. Segmenting text into words (or morphemes)
Part-of-speech tagging. Assign word-categories (nouns, verbs, particles, adjectives, etc.)
Lemmatization. Get dictionary forms for inflected verbs and adjectives
Readings. Extract readings for kanji
Several other features are supported. Please consult each dictionaries' Token class for details.
Installation
-
Add the dependency to your
shard.yml:dependencies: crystalmoji: github: rarnu/crystalmoji -
Run
shards install
Usage
require "crystalmoji"
Use it just like Kuromoji.
input = "高い攻撃力を誇る伝説のドラゴン。どんな相手でも粉砕する、その破壊力は計り知れない。"
tokenizer = CrystalMoji::Ipadic::Tokenizer.new
s1 = tokenizer.furigana(input)
s2 = tokenizer.remove_furigana(s1)
puts s1
puts s2
Contributing
- Fork it (https://github.com/rarnu/crystalmoji/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- rarnu - creator and maintainer
API
- Array(T)
An
Arrayis an ordered, integer-indexed collection of objects of type T. - ArrayExtension(T)
- BytesExtension
- CrystalMoji
- Crystalmoji
- Slice(T)
A
Sliceis aPointerwith an associated size. - String
A
Stringrepresents an immutable sequence of UTF-8 characters. - StringExtension