Search a term in Japanese

Ho provato tiny_segmenter da Rubygems e almeno genera le parole che ho elencato nel commento precedente.

# coding: utf-8
require 'tiny_segmenter'
require 'pp'

s = File.read('topic27.txt')

ts = TinySegmenter.new
sg = ts.segment(s, ignore_punctuation: true)
pp(sg)
bundle exec ruby test.rb | grep -e 北側 -e 真上 -e 一般
 "北側",
 "真上",
 "一般",
 "一般",
 "一般",
 "北側",
 "一般",

Una rapida ricerca su TinySegmenter mi ha detto che il modello che utilizza non è così buono. Esiste un generatore di modelli per esso.

Non l’ho ancora provato.

3 Mi Piace