gingerice 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/README.markdown +23 -7
- data/lib/gingerice/parser.rb +17 -15
- data/lib/gingerice/version.rb +1 -1
- data/test/test_gingerice.rb +8 -0
- metadata +15 -15
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
             | 
| 2 | 
            +
            !binary "U0hBMQ==":
         | 
| 3 | 
            +
              metadata.gz: !binary |-
         | 
| 4 | 
            +
                NjE5MDM1NzI2YWRmMzk1YTkyYmJmZDVmNzc3NzIzMzM5MTAzNWNlMw==
         | 
| 5 | 
            +
              data.tar.gz: !binary |-
         | 
| 6 | 
            +
                Y2JhYzlhYTI1ODIzMDZmMmFiYjYzMGZmM2I2ZmY1ZGI5MWFjZGM3NA==
         | 
| 5 7 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
             | 
| 8 | 
            +
              metadata.gz: !binary |-
         | 
| 9 | 
            +
                ZTgzMGFlNWNiN2M4ODRmOTc0ZDY4ZjA1NGI5NWJhOTYwZTc3NzU3NjEwZDYy
         | 
| 10 | 
            +
                ZWYyMTUxNzkyOWI1YjdmNmY5OWQ4ZTZjNDkzMDgyMDRlZDIxMDU4MTgwNzJl
         | 
| 11 | 
            +
                NGNiNGZlY2RmMjlkN2IyMDMwZmNkMzA1MmE2NDk4MmRkZjE3Mjc=
         | 
| 12 | 
            +
              data.tar.gz: !binary |-
         | 
| 13 | 
            +
                Yjg2Zjc0MGM2NzdiNGQ2YWJjM2E2ZThmZTY1OTgxZTkxMzE2MmIzNmRhNjZk
         | 
| 14 | 
            +
                MzM5YzlkZjM2MzcxMTExOGYxYWRhNmYxYmY4ZjFmMTg0ZjRmZDM3YTJmYWQ2
         | 
| 15 | 
            +
                OWFjM2EwMDJiYTFkZTdkZTY0ZjEwNmM0ZWJiYTg5NzQ5ZjdiMGU=
         | 
    
        data/README.markdown
    CHANGED
    
    | @@ -1,4 +1,10 @@ | |
| 1 | 
            -
            # Gingerice | 
| 1 | 
            +
            # Gingerice
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            [](http://badge.fury.io/rb/gingerice)
         | 
| 4 | 
            +
            [](https://travis-ci.org/subosito/gingerice)
         | 
| 5 | 
            +
            [](https://coveralls.io/r/subosito/gingerice)
         | 
| 6 | 
            +
            [](https://gemnasium.com/subosito/gingerice)
         | 
| 7 | 
            +
            [](https://codeclimate.com/github/subosito/gingerice)
         | 
| 2 8 |  | 
| 3 9 | 
             
            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.
         | 
| 4 10 |  | 
| @@ -31,7 +37,6 @@ text = 'The smelt of fliwers bring back memories.' | |
| 31 37 |  | 
| 32 38 | 
             
            parser = Gingerice::Parser.new
         | 
| 33 39 | 
             
            parser.parse text
         | 
| 34 | 
            -
             | 
| 35 40 | 
             
            ```
         | 
| 36 41 |  | 
| 37 42 | 
             
            ```
         | 
| @@ -44,17 +49,23 @@ parser.parse text | |
| 44 49 | 
             
                    [0] {
         | 
| 45 50 | 
             
                              "text" => "smelt",
         | 
| 46 51 | 
             
                           "correct" => "smell",
         | 
| 47 | 
            -
                        "definition" => nil
         | 
| 52 | 
            +
                        "definition" => nil,
         | 
| 53 | 
            +
                             "start" => 4,
         | 
| 54 | 
            +
                            "length" => 5
         | 
| 48 55 | 
             
                    },
         | 
| 49 56 | 
             
                    [1] {
         | 
| 50 57 | 
             
                              "text" => "fliwers",
         | 
| 51 58 | 
             
                           "correct" => "flowers",
         | 
| 52 | 
            -
                        "definition" => "a plant cultivated for its blooms or blossoms"
         | 
| 59 | 
            +
                        "definition" => "a plant cultivated for its blooms or blossoms",
         | 
| 60 | 
            +
                             "start" => 13,
         | 
| 61 | 
            +
                            "length" => 7
         | 
| 53 62 | 
             
                    },
         | 
| 54 63 | 
             
                    [2] {
         | 
| 55 64 | 
             
                              "text" => "bring",
         | 
| 56 65 | 
             
                           "correct" => "brings",
         | 
| 57 | 
            -
                        "definition" => nil
         | 
| 66 | 
            +
                        "definition" => nil,
         | 
| 67 | 
            +
                             "start" => 21,
         | 
| 68 | 
            +
                            "length" => 5
         | 
| 58 69 | 
             
                    }
         | 
| 59 70 | 
             
                ]
         | 
| 60 71 | 
             
            }
         | 
| @@ -88,12 +99,16 @@ $ gingerice --verbose "Edwards will be sck yesterday" | |
| 88 99 | 
             
                    [0] {
         | 
| 89 100 | 
             
                              "text" => "will be",
         | 
| 90 101 | 
             
                           "correct" => "was",
         | 
| 91 | 
            -
                        "definition" => nil
         | 
| 102 | 
            +
                        "definition" => nil,
         | 
| 103 | 
            +
                             "start" => 8,
         | 
| 104 | 
            +
                            "length" => 7
         | 
| 92 105 | 
             
                    },
         | 
| 93 106 | 
             
                    [1] {
         | 
| 94 107 | 
             
                              "text" => "sck",
         | 
| 95 108 | 
             
                           "correct" => "sick",
         | 
| 96 | 
            -
                        "definition" => "affected by an impairment of normal physical or mental function"
         | 
| 109 | 
            +
                        "definition" => "affected by an impairment of normal physical or mental function",
         | 
| 110 | 
            +
                             "start" => 16,
         | 
| 111 | 
            +
                            "length" => 3
         | 
| 97 112 | 
             
                    }
         | 
| 98 113 | 
             
                ]
         | 
| 99 114 | 
             
            }
         | 
| @@ -109,6 +124,7 @@ $ gingerice --verbose "Edwards will be sck yesterday" | |
| 109 124 |  | 
| 110 125 | 
             
            ## Ports
         | 
| 111 126 |  | 
| 127 | 
            +
            - PHP library by @Aitboudad: https://github.com/Aitboudad/GingerLight.git
         | 
| 112 128 | 
             
            - Python library by @Azd325: https://github.com/Azd325/gingerit
         | 
| 113 129 |  | 
| 114 130 | 
             
            ## Thanks
         | 
    
        data/lib/gingerice/parser.rb
    CHANGED
    
    | @@ -91,22 +91,24 @@ module Gingerice | |
| 91 91 | 
             
                  to   = data['To']
         | 
| 92 92 |  | 
| 93 93 | 
             
                  if i <= from
         | 
| 94 | 
            -
                    @result | 
| 95 | 
            -
                     | 
| 96 | 
            -
             | 
| 97 | 
            -
                     | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 94 | 
            +
                    @result   += text[i..from-1] unless from.zero?
         | 
| 95 | 
            +
                    suggestion = data['Suggestions'].first
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                    if suggestion
         | 
| 98 | 
            +
                      suggestion_text = suggestion['Text']
         | 
| 99 | 
            +
                      @result += suggestion_text
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                      definition = suggestion['Definition']
         | 
| 102 | 
            +
                      definition = nil if definition.respond_to?(:empty?) && definition.empty?
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                      @corrections << {
         | 
| 105 | 
            +
                        'text'       => text[from..to],
         | 
| 106 | 
            +
                        'correct'    => suggestion_text,
         | 
| 107 | 
            +
                        'definition' => definition,
         | 
| 108 | 
            +
                        'start'      => from,
         | 
| 109 | 
            +
                        'length'     => to - from + 1
         | 
| 110 | 
            +
                      }
         | 
| 101 111 | 
             
                    end
         | 
| 102 | 
            -
             | 
| 103 | 
            -
                    @corrections << {
         | 
| 104 | 
            -
                      'text'       => text[from..to],
         | 
| 105 | 
            -
                      'correct'    => data['Suggestions'][0]['Text'],
         | 
| 106 | 
            -
                      'definition' => definition,
         | 
| 107 | 
            -
                      'start'      => from,
         | 
| 108 | 
            -
                      'length'     => to - from + 1
         | 
| 109 | 
            -
                    }
         | 
| 110 112 | 
             
                  end
         | 
| 111 113 | 
             
                end
         | 
| 112 114 |  | 
    
        data/lib/gingerice/version.rb
    CHANGED
    
    
    
        data/test/test_gingerice.rb
    CHANGED
    
    | @@ -69,6 +69,14 @@ class TestGingerice < Test::Unit::TestCase | |
| 69 69 | 
             
                assert_equal "Edwards was sick yesterday\n", output.string
         | 
| 70 70 | 
             
              end
         | 
| 71 71 |  | 
| 72 | 
            +
              def test_command_simple_output_cryptic
         | 
| 73 | 
            +
                output = capture_stdout do
         | 
| 74 | 
            +
                  command = Gingerice::Command.new([":tco"])
         | 
| 75 | 
            +
                  command.execute
         | 
| 76 | 
            +
                end
         | 
| 77 | 
            +
                assert_equal ": \n", output.string
         | 
| 78 | 
            +
              end
         | 
| 79 | 
            +
             | 
| 72 80 | 
             
              def test_command_verbose_output
         | 
| 73 81 | 
             
                output = capture_stdout do
         | 
| 74 82 | 
             
                  command = Gingerice::Command.new(["-v", "He flyed to Jakarta"])
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: gingerice
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.2. | 
| 4 | 
            +
              version: 1.2.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Alif Rachmawadi
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2014-01-22 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -28,70 +28,70 @@ dependencies: | |
| 28 28 | 
             
              name: rake
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 | 
            -
                - - '>='
         | 
| 31 | 
            +
                - - ! '>='
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 33 | 
             
                    version: '0'
         | 
| 34 34 | 
             
              type: :development
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 | 
            -
                - - '>='
         | 
| 38 | 
            +
                - - ! '>='
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: '0'
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: simplecov
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 | 
            -
                - - '>='
         | 
| 45 | 
            +
                - - ! '>='
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 47 | 
             
                    version: '0'
         | 
| 48 48 | 
             
              type: :development
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 | 
            -
                - - '>='
         | 
| 52 | 
            +
                - - ! '>='
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 54 | 
             
                    version: '0'
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: coveralls
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 58 | 
             
                requirements:
         | 
| 59 | 
            -
                - - '>='
         | 
| 59 | 
            +
                - - ! '>='
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 61 | 
             
                    version: '0'
         | 
| 62 62 | 
             
              type: :development
         | 
| 63 63 | 
             
              prerelease: false
         | 
| 64 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 65 | 
             
                requirements:
         | 
| 66 | 
            -
                - - '>='
         | 
| 66 | 
            +
                - - ! '>='
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 68 | 
             
                    version: '0'
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 70 | 
             
              name: addressable
         | 
| 71 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 72 | 
             
                requirements:
         | 
| 73 | 
            -
                - - '>='
         | 
| 73 | 
            +
                - - ! '>='
         | 
| 74 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 75 | 
             
                    version: '0'
         | 
| 76 76 | 
             
              type: :runtime
         | 
| 77 77 | 
             
              prerelease: false
         | 
| 78 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 79 | 
             
                requirements:
         | 
| 80 | 
            -
                - - '>='
         | 
| 80 | 
            +
                - - ! '>='
         | 
| 81 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 82 | 
             
                    version: '0'
         | 
| 83 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 84 | 
             
              name: awesome_print
         | 
| 85 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 86 | 
             
                requirements:
         | 
| 87 | 
            -
                - - '>='
         | 
| 87 | 
            +
                - - ! '>='
         | 
| 88 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 89 89 | 
             
                    version: '0'
         | 
| 90 90 | 
             
              type: :runtime
         | 
| 91 91 | 
             
              prerelease: false
         | 
| 92 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 93 | 
             
                requirements:
         | 
| 94 | 
            -
                - - '>='
         | 
| 94 | 
            +
                - - ! '>='
         | 
| 95 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 96 | 
             
                    version: '0'
         | 
| 97 97 | 
             
            description: Corrects spelling and grammar mistakes based on the context of complete
         | 
| @@ -127,17 +127,17 @@ require_paths: | |
| 127 127 | 
             
            - lib
         | 
| 128 128 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 129 129 | 
             
              requirements:
         | 
| 130 | 
            -
              - - '>='
         | 
| 130 | 
            +
              - - ! '>='
         | 
| 131 131 | 
             
                - !ruby/object:Gem::Version
         | 
| 132 132 | 
             
                  version: '0'
         | 
| 133 133 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 134 134 | 
             
              requirements:
         | 
| 135 | 
            -
              - - '>='
         | 
| 135 | 
            +
              - - ! '>='
         | 
| 136 136 | 
             
                - !ruby/object:Gem::Version
         | 
| 137 137 | 
             
                  version: '0'
         | 
| 138 138 | 
             
            requirements: []
         | 
| 139 139 | 
             
            rubyforge_project: 
         | 
| 140 | 
            -
            rubygems_version: 2. | 
| 140 | 
            +
            rubygems_version: 2.1.9
         | 
| 141 141 | 
             
            signing_key: 
         | 
| 142 142 | 
             
            specification_version: 4
         | 
| 143 143 | 
             
            summary: Corrects spelling and grammar mistakes based on the context of complete sentences.
         |