Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/subosito/gingerice

Ruby wrapper for correcting spelling and grammar mistakes based on the context of complete sentences.
https://github.com/subosito/gingerice

ruby rubygem

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

# Gingerice

[![Gem Version](https://badge.fury.io/rb/gingerice.svg)](https://badge.fury.io/rb/gingerice)
[![Build Status](https://travis-ci.org/subosito/gingerice.svg?branch=master)](https://travis-ci.org/subosito/gingerice)
[![Coverage Status](https://coveralls.io/repos/github/subosito/gingerice/badge.svg?branch=master)](https://coveralls.io/github/subosito/gingerice?branch=master)
[![Maintainability](https://api.codeclimate.com/v1/badges/86b7817ae1779428f3a3/maintainability)](https://codeclimate.com/github/subosito/gingerice/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:

```ruby
gem 'gingerice'
```

And then execute:

```bash
$ bundle
```

Or install it yourself as:

```bash
$ gem install gingerice
```

## Usage

```ruby
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:

```bash
$ gingerice "Edwards will be sck yesterday"
```

```
# output:

Edwards was sick yesterday
```

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

```bash
$ 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

- PHP library by @Aitboudad: https://github.com/Aitboudad/GingerLight.git
- Python library by @Azd325: https://github.com/Azd325/gingerit

## Thanks

Thank you for [Ginger Proofreader](http://www.gingersoftware.com/) for such awesome service. Hope they will keep it free :)