
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Naive Bayes classifier for japanse text.
JnbClassifier helps you classify japanese text.
You need Morphological Analysis Tool, Mecab and the dictionary to use JnbClassifier.
If you use linux(ubuntu), you can install Mecab and the dictionary as follows.
1:Mecab download site: https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE
$ cd mecab-X.X
$ ./configure
$ make
$ make check
$ sudo make install
2:the dictionary for Mecab download site: https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM
$ tar zxfv mecab-ipadic-2.7.0-XXXX.tar.gz
$ cd mecab-ipadic-2.7.0-XXXX
$ ./configure --with-charset=utf8
$ make
$ sudo make install
Add this line to your application's Gemfile
gem 'jnb_classifier'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jnb_classifier
First you need create documents which neeed two parameters: category name and text.
document1 = JnbClassifier::Document.new('hayao','私の住んでいる場所は風の谷ではありません。')
#=> @label="hayao", @attributes={"私"=>1, "場所"=>1, "風"=>1, "谷"=>1}
document2 = JnbClassifier::Document.new('hayao','私は魔女の宅急便が大好きです')
#=> @label="hayao", @attributes={"私"=>1, "魔女"=>1, "宅急便"=>1, "大好き"=>1}
document3 = JnbClassifier::Document.new('hujiko','僕、ドラえもん。')
#=> @label="hujiko", @attributes={"僕"=>1, "ドラえもん"=>1}
Your classifier can learn from documents you created.
And the more you give apropriate samples, the smarter your classifier will be.
nb = nb = JnbClassifier::Classifier.new
mb.learn(document1)
mb.learn(document2)
mb.learn(document3)
When you input attributes(hash), ,classify method return the category which is selected by Naive Bayes.
nb.classify({"私"=>1, "魔女"=>1, "宅急便"=>1} )
#=> "hayao"
nb.result
#=> {"hayao"=>-16.72902719126572, "hujiko"=>-20.435583764494627} # the values is logarithm.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jnb_classifier. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the JnbClassifier project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that jnb_classifier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.