kyow / igo-ruby Goto Github PK
View Code? Open in Web Editor NEWigo-rubyは日本語形態素解析器IgoのRuby実装です。
Home Page: https://rubygems.org/gems/igo-ruby
License: MIT License
igo-rubyは日本語形態素解析器IgoのRuby実装です。
Home Page: https://rubygems.org/gems/igo-ruby
License: MIT License
igo-ruby を開発してくださりありがとうございます。お世話になっております。
🐘
などが含まれている文字列を Igo::Tagger#parse に渡すと、 TypeError になります。以下再現コードです。
igo_tagger = Igo::Tagger.new(dict)
igo_tagger.parse('🐘')
エラーメッセージ
TypeError: no implicit conversion from nil to integer
stacktrace
"/opt/asdf-data/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/igo-ruby-0.1.5/lib/igo/dictionary.rb:36:in `category'",
"/opt/asdf-data/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/igo-ruby-0.1.5/lib/igo/dictionary.rb:115:in `search'",
"/opt/asdf-data/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/igo-ruby-0.1.5/lib/igo/tagger.rb:90:in `block in impl'",
"/opt/asdf-data/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/each.rb:9:in `each'",
"/opt/asdf-data/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/each.rb:9:in `each'",
"/opt/asdf-data/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/igo-ruby-0.1.5/lib/igo/tagger.rb:85:in `impl'",
"/opt/asdf-data/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/igo-ruby-0.1.5/lib/igo/tagger.rb:44:in `parse'",
igo-ruby/lib/igo/dictionary.rb
Line 36 in d02daa0
@char2id
は、length が 65536 しか無いが、🐘
のコードは 128024 であり、@char2id[code]
が nil になることが原因です。
@char2id を辞書上で拡張するのが良いと思うのですが、@char2id が nil の場合はどうやっても発生しうると思うので、 nilの場合の category を定義するといいと考えています。 id=0 の category にすることを提案します。この方針で問題なければPRも作成します。
何卒よろしくお願いいたします。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.