= Corrector
{}[https://rubygems.org/gems/corrector]
{}[https://travis-ci.org/nepalez/corrector]
{}[https://codeclimate.com/github/nepalez/corrector]
{}[https://gemnasium.com/nepalez/corrector]
{}[https://coveralls.io/r/nepalez/corrector]
{}[https://github.com/nepalez/corrector/blob/master/LICENSE.rdoc]
== About
Rails plugin for cyrillic texts correction using words and phrases dictionary.
It defines two dictionaries:
+Word+:: A dictionary of words
+Prefix+:: A dictionary of word prefixes
+Phrase+:: A dictionary of phrases
and a service +Parse+ that:
* converts a source text to uppercase cyrillic one;
* breaks it to words;
* corrects any single word using +Prefix+ and +Word+ dictionaries;
* puts corrected words back to sentence;
* corrects the sentence using the +Phrase+ dictionary;
* returns the result.
The model is expected to be used as a part of various classificators - to allow
searching items by words in Russian.
=== Example
After adding some words and phrases:
Prefix.create! from: "КИЛО", to: "К", source: "UNITS"
Word.create! from: "МЕТРОВ", to: "М", source: "UNITS"
Word.create! from: "СЕКУНДУ", to: "С", source: "UNITS"
Phrase.create! from: "КМ В С", to: "ТЫС М/С", source: "UNITS"
the phrase can be corrected properly:
Parse.new "килоmетров в секyndу", source: "UNITS" # => "ТЫС М/С"
== Installation
Add this line to your application's Gemfile:
gem "corrector"
And then execute:
$ bundle
Or install it yourself as:
$ gem install corrector
== Initialization
You should:
* copy the module's db migrations to your project and run them;
* copy the module's factories (for usage in your Rspec tests).
To do all of above you can use corrector:install rake task:
=== in a Rails application
$ rake corrector:install
=== in a Rails mountable engine
$ rake app:corrector:install
== Contributing
1. Fork it ( https://github.com/nepalez/corrector/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request
== License
The plugin is distributed under {MIT license}[https://github.com/nepalez/corrector/blob/master/LICENSE.rdoc]