Skip to content
This repository has been archived by the owner on May 1, 2021. It is now read-only.

subosito/gingerice

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
May 1, 2013 06:46
lib
July 4, 2019 23:34
July 4, 2019 23:31
April 25, 2013 13:44
April 25, 2013 13:44
July 4, 2019 22:42
April 27, 2013 15:43

Gingerice

Gem Version Build Status Coverage Status Maintainability

Ruby wrapper of Ginger Proofreader which corrects spelling and grammar mistakes based on the context of complete sentences by comparing each sentence to billions of similar sentences from the web.

Installation

Add this line to your application's Gemfile:

gem 'gingerice'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gingerice

Usage

require 'gingerice'

text = 'The smelt of fliwers bring back memories.'

parser = Gingerice::Parser.new
parser.parse text
# output:

{
           "text" => "The smelt of fliwers bring back memories.",
         "result" => "The smell of flowers brings back memories.",
    "corrections" => [
        [0] {
                  "text" => "smelt",
               "correct" => "smell",
            "definition" => nil,
                 "start" => 4,
                "length" => 5
        },
        [1] {
                  "text" => "fliwers",
               "correct" => "flowers",
            "definition" => "a plant cultivated for its blooms or blossoms",
                 "start" => 13,
                "length" => 7
        },
        [2] {
                  "text" => "bring",
               "correct" => "brings",
            "definition" => nil,
                 "start" => 21,
                "length" => 5
        }
    ]
}

This gem also provides executable which can be executed:

$ gingerice "Edwards will be sck yesterday"
# output:

Edwards was sick yesterday

Or if you want verbose output you can add --verbose or -v argument:

$ gingerice --verbose "Edwards will be sck yesterday"
# output:

{
           "text" => "Edwards will be sck yesterday",
         "result" => "Edwards was sick yesterday",
    "corrections" => [
        [0] {
                  "text" => "will be",
               "correct" => "was",
            "definition" => nil,
                 "start" => 8,
                "length" => 7
        },
        [1] {
                  "text" => "sck",
               "correct" => "sick",
            "definition" => "affected by an impairment of normal physical or mental function",
                 "start" => 16,
                "length" => 3
        }
    ]
}

Contributing

  1. Fork it
  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 new Pull Request

Ports

Thanks

Thank you for Ginger Proofreader for such awesome service. Hope they will keep it free :)

About

Ruby wrapper for correcting spelling and grammar mistakes based on the context of complete sentences.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages