chat_correct 0.0.4 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a3c1125d076cc373a05732ae72b73cf765a7c224
4
- data.tar.gz: ae70fb4edcbc9496bdb6dba95bdcd132d7232a15
2
+ SHA256:
3
+ metadata.gz: aa2d4b869524c85df7b0ce4162374ccd13ee9aca0dd07790f0c0a4295b9c092c
4
+ data.tar.gz: 81cd90af36bfe8718265759f624821541d9b9a151a6d802e7e1c50eb48bac7e7
5
5
  SHA512:
6
- metadata.gz: 9b88d5e0e976dc93adc26d0b2e3ef9e55c45a5c49877b968e9d021bc11c6290c4450b7c1a68d968c90efb53c9da05d563a9bd97bd583baae4691b4b5df5aa9f9
7
- data.tar.gz: 37f587c0abfe10c0bf39386ec82d4614a8cbbeed1d95044cb14ed4c160edf10ade74434ff588b0f433e5346580209b23c2f3e4f1cafce73673d3625a839c315e
6
+ metadata.gz: 61cfc522adf14045f991e9e5148e705228e26345471af66473e9c21b8507e114c2670847b4d58ff7f0f01ba3fc6c465f20ba6b0325ae330d437083e9d16a0c8b
7
+ data.tar.gz: b34d98caba93fa929c3001aada68acfba4b01431de89b6cd2cba4d8eedbef8c3f8f21c2876c34c13d2646dd686b0baf81d13c75695e124dfe42537d12c1ff70a
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - "2.1.0"
3
4
  - "2.1.5"
4
- - "2.2.0"
5
+ - "2.2.0"
data/README.md CHANGED
@@ -8,17 +8,17 @@ Live Demo: [Chat Correct chat room application](http://www.chat-correct.com)
8
8
 
9
9
  ![](https://s3.amazonaws.com/tm-town-nlp-resources/chat_correct_screenshot.jpg)
10
10
 
11
- ##Install
11
+ ##Install
12
12
 
13
13
  **Ruby**
14
- *Supports Ruby 2.1.5 and above*
14
+ *Supports Ruby 2.1.0 and above*
15
15
  ```
16
16
  gem install chat_correct
17
17
  ```
18
18
 
19
19
  **Ruby on Rails**
20
- Add this line to your application’s Gemfile:
21
- ```ruby
20
+ Add this line to your application’s Gemfile:
21
+ ```ruby
22
22
  gem 'chat_correct'
23
23
  ```
24
24
 
@@ -144,8 +144,8 @@ os = "is the, puncttuation are wrong."
144
144
  cs = "Is the punctuation wrong?"
145
145
  cc = ChatCorrect::Correct.new(original_sentence: os, corrected_sentence: cs)
146
146
  cc.mistake_report
147
- # => {
148
- # 'missing_word' => 0,
147
+ # => {
148
+ # 'missing_word' => 0,
149
149
  # 'unnecessary_word' => 1,
150
150
  # 'spelling' => 1,
151
151
  # 'verb' => 0,
@@ -205,4 +205,5 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
205
205
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
206
206
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
207
207
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
208
- THE SOFTWARE.
208
+ THE SOFTWARE.
209
+
data/chat_correct.gemspec CHANGED
@@ -17,8 +17,9 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
+ spec.required_ruby_version = '>= 2.1.0'
20
21
 
21
- spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "bundler"
22
23
  spec.add_development_dependency "rake", "~> 10.0"
23
24
  spec.add_development_dependency "rspec"
24
25
  spec.add_runtime_dependency "text"
@@ -10,24 +10,30 @@ module ChatCorrect
10
10
  end
11
11
 
12
12
  def correct
13
+ raise "You must include an Original Sentence" if original_sentence.nil? || original_sentence.eql?('')
14
+ raise "You must include a Corrected Sentence" if corrected_sentence.nil? || corrected_sentence.eql?('')
13
15
  analyze
14
16
  end
15
17
 
16
18
  def mistakes
19
+ raise "You must include an Original Sentence" if original_sentence.nil? || original_sentence.eql?('')
20
+ raise "You must include a Corrected Sentence" if corrected_sentence.nil? || corrected_sentence.eql?('')
17
21
  mistakes_hash = {}
18
22
  analyze.each do |key, value|
19
- next if !value['type'].split('_')[-1].eql?('mistake') || value['type'].split('_')[0].eql?('no')
23
+ next if (!value['type'].split('_')[-1].eql?('mistake') && !value['type'].split('_')[0].eql?('missing')) || value['type'].split('_')[0].eql?('no')
20
24
  mistakes_hash = build_mistakes_hash(mistakes_hash, key, value)
21
25
  end
22
26
  mistakes_hash
23
27
  end
24
28
 
25
29
  def mistake_report
30
+ raise "You must include an Original Sentence" if original_sentence.nil? || original_sentence.eql?('')
31
+ raise "You must include a Corrected Sentence" if corrected_sentence.nil? || corrected_sentence.eql?('')
26
32
  mistake_report_hash = {}
27
33
  TYPES_OF_MISTAKES.each do |mistake|
28
34
  counter = 0
29
35
  mistakes.each do |key, value|
30
- counter += 1 if value['error_type'].eql?(mistake)
36
+ counter += 1 if value['error_type'].eql?(mistake) || value['error_type'].split('_')[1].eql?(mistake)
31
37
  end
32
38
  mistake_report_hash[mistake] = counter
33
39
  end
@@ -35,6 +41,8 @@ module ChatCorrect
35
41
  end
36
42
 
37
43
  def number_of_mistakes
44
+ raise "You must include an Original Sentence" if original_sentence.nil? || original_sentence.eql?('')
45
+ raise "You must include a Corrected Sentence" if corrected_sentence.nil? || corrected_sentence.eql?('')
38
46
  mistakes.length
39
47
  end
40
48
 
@@ -46,32 +54,36 @@ module ChatCorrect
46
54
 
47
55
  def iterate_stages
48
56
  stage_1
49
- debug
57
+ # debug
50
58
  stage_2
51
- debug
59
+ # debug
52
60
  iterate_sentences('stage_3')
53
- debug
61
+ # debug
54
62
  iterate_sentences('stage_4')
55
- debug
63
+ # debug
56
64
  iterate_sentences('stage_5')
57
- debug
65
+ # debug
58
66
  iterate_sentences('stage_6')
59
- debug
67
+ # debug
60
68
  iterate_sentences('stage_7')
61
- debug
69
+ # debug
62
70
  stage_8
63
- debug
71
+ # debug
64
72
  prev_next_match_check
65
- debug
73
+ # debug
66
74
  stage_9
67
- debug
75
+ # debug
68
76
  correction_hash = ChatCorrect::CorrectionsHash.new(original_sentence_info_hash: original_sentence_info_hash, corrected_sentence_info_hash: corrected_sentence_info_hash).create
69
77
  build_corrections_hash(correction_hash)
70
78
  end
71
79
 
72
80
  def update_interim_hash_with_error(interim_hash, value)
73
81
  if value['type'].split('_').length > 2
74
- interim_hash['error_type'] = value['type'].split('_')[0] + '_' + value['type'].split('_')[1]
82
+ if value['type'].split('_')[1].eql?('punctuation')
83
+ interim_hash['error_type'] = 'punctuation'
84
+ else
85
+ interim_hash['error_type'] = value['type'].split('_')[0] + '_' + value['type'].split('_')[1]
86
+ end
75
87
  else
76
88
  interim_hash['error_type'] = value['type'].split('_')[0]
77
89
  end
@@ -79,7 +91,9 @@ module ChatCorrect
79
91
  end
80
92
 
81
93
  def update_interim_hash_with_correction(interim_hash, key)
82
- if correct[key + 1]['type'].split('_')[0].eql?(correct[key]['type'].split('_')[0])
94
+ if correct[key]['type'].split('_')[1].eql?('order')
95
+ interim_hash['correction'] = 'N/A'
96
+ elsif correct[key + 1]['type'].split('_')[0].eql?(correct[key]['type'].split('_')[0])
83
97
  interim_hash['correction'] = correct[key + 1]['token']
84
98
  else
85
99
  interim_hash['correction'] = ''
@@ -91,8 +105,22 @@ module ChatCorrect
91
105
  interim_hash = {}
92
106
  interim_hash['position'] = key
93
107
  interim_hash = update_interim_hash_with_error(interim_hash, value)
94
- interim_hash['mistake'] = value['token']
95
- interim_hash = update_interim_hash_with_correction(interim_hash, key) unless correct[key + 1].blank?
108
+ if value['type'].split('_')[1].eql?('order')
109
+ if mistakes_hash.length.eql?(0) || mistakes_hash[0]['error_type'].eql?('unnecessary_word') || mistakes_hash[0]['error_type'].eql?('word_order')
110
+ interim_hash['mistake'] = reverse_symbols(original_sentence_info_hash[key]['token'])
111
+ else
112
+ interim_hash['mistake'] = reverse_symbols(original_sentence_info_hash[key - 1]['token'])
113
+ end
114
+ elsif value['type'].split('_').length > 2 && value['type'].split('_')[1].eql?('punctuation')
115
+ interim_hash['mistake'] = ''
116
+ else
117
+ interim_hash['mistake'] = value['token']
118
+ end
119
+ if correct[key + 1].blank? && value['type'].split('_')[1].eql?('order')
120
+ interim_hash['correction'] = 'N/A'
121
+ else
122
+ interim_hash = update_interim_hash_with_correction(interim_hash, key) unless correct[key + 1].blank?
123
+ end
96
124
  mistakes_hash[mistakes_hash.length] = interim_hash
97
125
  mistakes_hash
98
126
  end
@@ -232,9 +260,9 @@ module ChatCorrect
232
260
 
233
261
  def debug
234
262
  # puts "++++++++++++++++++++"
235
- original_sentence_info_hash.each do |k, v|
263
+ # original_sentence_info_hash.each do |k, v|
236
264
  # puts 'Key: ' + k.to_s + '; Word: ' + v['token'].to_s + '; Match ID: ' + v['match_id'].to_s
237
- end
265
+ # end
238
266
  end
239
267
 
240
268
  def stage_1
@@ -17,7 +17,7 @@ module ChatCorrect
17
17
  @mistake_info = {}
18
18
  if @j >= original_sentence_info_hash.length
19
19
  if corrected_sentence_info_hash[@i]['token'].gsub(/[[:punct:]]/, '').eql?('')
20
- @correct_info[corrected_sentence_info_hash[@i]['token']] = 'missing_punctuation_mistake'
20
+ @correct_info[corrected_sentence_info_hash[@i]['token']] = 'missing_punctuation_correction'
21
21
  @combined_hash[@combined_hash.length] = @correct_info
22
22
  else
23
23
  @correct_info[corrected_sentence_info_hash[@i]['token']] = 'missing_word_mistake'
@@ -126,7 +126,7 @@ module ChatCorrect
126
126
  when ChatCorrect::MistakeAnalyzer.new(original: original, corrected: corrected).punctuation_mistake?
127
127
  update_combined_hash('punctuation_mistake', original['token'], corrected['token'], nil)
128
128
  when ChatCorrect::MistakeAnalyzer.new(original: original, corrected: corrected).unnecessary_word_missing_punctuation_mistake?
129
- update_combined_hash('unnecessary_word_mistake', original['token'], corrected['token'], 'missing_punctuation_mistake')
129
+ update_combined_hash('unnecessary_word_mistake', original['token'], corrected['token'], 'missing_punctuation_correction')
130
130
  else
131
131
  update_combined_hash('word_choice_mistake', original['token'], corrected['token'], nil)
132
132
  end
@@ -166,7 +166,7 @@ module ChatCorrect
166
166
  if corrected_sentence_info_hash[@i]['token'].gsub(/[[:punct:]]/, '').eql?('')
167
167
  update_combined_hash_single_mistake_corrected('punctuation_mistake')
168
168
  else
169
- if @j != 0
169
+ if @j != 0 && @i != 0
170
170
  concatenated_corrected_string = corrected_sentence_info_hash[@i - 1]['token'].to_s + corrected_sentence_info_hash[@i]['token'].to_s
171
171
  if ChatCorrect::Possessive.new(token_a: original_sentence_info_hash[@j - 1]['token'], token_b: concatenated_corrected_string).possessive?
172
172
  @mistake_info[original_sentence_info_hash[@j - 1]['token']] = 'possessive_mistake'
@@ -1,3 +1,3 @@
1
1
  module ChatCorrect
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -14,4 +14,18 @@ RSpec.describe ChatCorrect::Capitalization do
14
14
  cc = ChatCorrect::Capitalization.new(token_a: token_a, token_b: token_b)
15
15
  expect(cc.capitalization_error?).to eq(false)
16
16
  end
17
+
18
+ it 'should return false if token_a and token_b are not equal because this is a word choice error, not capitalization' do
19
+ token_a = 'Usa'
20
+ token_b = 'USA'
21
+ cc = ChatCorrect::Capitalization.new(token_a: token_a, token_b: token_b)
22
+ expect(cc.capitalization_error?).to eq(true)
23
+ end
24
+
25
+ it 'should return false if token_a and token_b are not equal because this is a word choice error, not capitalization' do
26
+ token_a = 'hEllo'
27
+ token_b = 'Hello'
28
+ cc = ChatCorrect::Capitalization.new(token_a: token_a, token_b: token_b)
29
+ expect(cc.capitalization_error?).to eq(true)
30
+ end
17
31
  end
@@ -60,6 +60,10 @@ RSpec.describe ChatCorrect::Correct do
60
60
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"need", "type"=>"no_mistake"}, 2=>{"token"=>"to", "type"=>"missing_word_mistake"}, 3=>{"token"=>"go", "type"=>"no_mistake"}, 4=>{"token"=>"shopping", "type"=>"no_mistake"}, 5=>{"token"=>"at", "type"=>"unnecessary_word_mistake"}, 6=>{"token"=>"this", "type"=>"no_mistake"}, 7=>{"token"=>"weekend", "type"=>"no_mistake"}, 8=>{"token"=>".", "type"=>"no_mistake"}})
61
61
  end
62
62
 
63
+ it 'Reports the mistakes' do
64
+ expect(@cc.mistakes).to eq({0=>{"position"=>2, "error_type"=>"missing_word", "mistake"=>"to", "correction"=>""}, 1=>{"position"=>5, "error_type"=>"unnecessary_word", "mistake"=>"at", "correction"=>""}})
65
+ end
66
+
63
67
  it 'Counts the number of mistakes' do
64
68
  expect(@cc.number_of_mistakes).to eq(2)
65
69
  end
@@ -80,6 +84,10 @@ RSpec.describe ChatCorrect::Correct do
80
84
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"go", "type"=>"verb_mistake"}, 2=>{"token"=>"went", "type"=>"verb_correction"}, 3=>{"token"=>"on", "type"=>"missing_word_mistake"}, 4=>{"token"=>"a", "type"=>"missing_word_mistake"}, 5=>{"token"=>"trip", "type"=>"no_mistake"}, 6=>{"token"=>"last", "type"=>"no_mistake"}, 7=>{"token"=>"month", "type"=>"no_mistake"}, 8=>{"token"=>".", "type"=>"no_mistake"}})
81
85
  end
82
86
 
87
+ it 'Reports the mistakes' do
88
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"verb", "mistake"=>"go", "correction"=>"went"}, 1=>{"position"=>3, "error_type"=>"missing_word", "mistake"=>"on", "correction"=>"a"}, 2=>{"position"=>4, "error_type"=>"missing_word", "mistake"=>"a", "correction"=>""}})
89
+ end
90
+
83
91
  it 'Counts the number of mistakes' do
84
92
  expect(@cc.number_of_mistakes).to eq(3)
85
93
  end
@@ -100,6 +108,10 @@ RSpec.describe ChatCorrect::Correct do
100
108
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"an", "type"=>"no_mistake"}, 3=>{"token"=>"exclamation", "type"=>"no_mistake"}, 4=>{"token"=>".", "type"=>"punctuation_mistake"}, 5=>{"token"=>"!", "type"=>"punctuation_correction"}})
101
109
  end
102
110
 
111
+ it 'Reports the mistakes' do
112
+ expect(@cc.mistakes).to eq({0=>{"position"=>4, "error_type"=>"punctuation", "mistake"=>".", "correction"=>"!"}})
113
+ end
114
+
103
115
  it 'Counts the number of mistakes' do
104
116
  expect(@cc.number_of_mistakes).to eq(1)
105
117
  end
@@ -120,6 +132,10 @@ RSpec.describe ChatCorrect::Correct do
120
132
  expect(@cc.correct).to eq({0=>{"token"=>"what", "type"=>"capitalization_mistake"}, 1=>{"token"=>"What", "type"=>"capitalization_correction"}, 2=>{"token"=>"am", "type"=>"verb_mistake"}, 3=>{"token"=>"was", "type"=>"verb_correction"}, 4=>{"token"=>"i", "type"=>"capitalization_mistake"}, 5=>{"token"=>"I", "type"=>"capitalization_correction"}, 6=>{"token"=>"thinking", "type"=>"no_mistake"}, 7=>{"token"=>"!", "type"=>"punctuation_mistake"}, 8=>{"token"=>"?", "type"=>"punctuation_correction"}})
121
133
  end
122
134
 
135
+ it 'Reports the mistakes' do
136
+ expect(@cc.mistakes).to eq({0=>{"position"=>0, "error_type"=>"capitalization", "mistake"=>"what", "correction"=>"What"}, 1=>{"position"=>2, "error_type"=>"verb", "mistake"=>"am", "correction"=>"was"}, 2=>{"position"=>4, "error_type"=>"capitalization", "mistake"=>"i", "correction"=>"I"}, 3=>{"position"=>7, "error_type"=>"punctuation", "mistake"=>"!", "correction"=>"?"}})
137
+ end
138
+
123
139
  it 'Counts the number of mistakes' do
124
140
  expect(@cc.number_of_mistakes).to eq(4)
125
141
  end
@@ -140,6 +156,10 @@ RSpec.describe ChatCorrect::Correct do
140
156
  expect(@cc.correct).to eq({0=>{"token"=>"There", "type"=>"no_mistake"}, 1=>{"token"=>"arre", "type"=>"spelling_mistake"}, 2=>{"token"=>"are", "type"=>"spelling_correction"}, 3=>{"token"=>"a", "type"=>"missing_word_mistake"}, 4=>{"token"=>"lotts", "type"=>"spelling_mistake"}, 5=>{"token"=>"lot", "type"=>"spelling_correction"}, 6=>{"token"=>"of", "type"=>"no_mistake"}, 7=>{"token"=>"misspeellings", "type"=>"spelling_mistake"}, 8=>{"token"=>"misspellings", "type"=>"spelling_correction"}, 9=>{"token"=>".", "type"=>"no_mistake"}})
141
157
  end
142
158
 
159
+ it 'Reports the mistakes' do
160
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"spelling", "mistake"=>"arre", "correction"=>"are"}, 1=>{"position"=>3, "error_type"=>"missing_word", "mistake"=>"a", "correction"=>""}, 2=>{"position"=>4, "error_type"=>"spelling", "mistake"=>"lotts", "correction"=>"lot"}, 3=>{"position"=>7, "error_type"=>"spelling", "mistake"=>"misspeellings", "correction"=>"misspellings"}})
161
+ end
162
+
143
163
  it 'Counts the number of mistakes' do
144
164
  expect(@cc.number_of_mistakes).to eq(4)
145
165
  end
@@ -160,6 +180,10 @@ RSpec.describe ChatCorrect::Correct do
160
180
  expect(@cc.correct).to eq({0=>{"token"=>"There", "type"=>"no_mistake"}, 1=>{"token"=>"arre", "type"=>"spelling_mistake"}, 2=>{"token"=>"are", "type"=>"spelling_correction"}, 3=>{"token"=>"a", "type"=>"missing_word_mistake"}, 4=>{"token"=>"lotts", "type"=>"spelling_mistake"}, 5=>{"token"=>"lot", "type"=>"spelling_correction"}, 6=>{"token"=>",", "type"=>"punctuation_mistake"}, 7=>{"token"=>"off", "type"=>"spelling_mistake"}, 8=>{"token"=>"of", "type"=>"spelling_correction"}, 9=>{"token"=>"consecutiveee", "type"=>"spelling_mistake"}, 10=>{"token"=>"consecutive", "type"=>"spelling_correction"}, 11=>{"token"=>"misspeellings", "type"=>"spelling_mistake"}, 12=>{"token"=>"misspellings", "type"=>"spelling_correction"}, 13=>{"token"=>"!", "type"=>"punctuation_mistake"}, 14=>{"token"=>".", "type"=>"punctuation_correction"}})
161
181
  end
162
182
 
183
+ it 'Reports the mistakes' do
184
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"spelling", "mistake"=>"arre", "correction"=>"are"}, 1=>{"position"=>3, "error_type"=>"missing_word", "mistake"=>"a", "correction"=>""}, 2=>{"position"=>4, "error_type"=>"spelling", "mistake"=>"lotts", "correction"=>"lot"}, 3=>{"position"=>6, "error_type"=>"punctuation", "mistake"=>",", "correction"=>""}, 4=>{"position"=>7, "error_type"=>"spelling", "mistake"=>"off", "correction"=>"of"}, 5=>{"position"=>9, "error_type"=>"spelling", "mistake"=>"consecutiveee", "correction"=>"consecutive"}, 6=>{"position"=>11, "error_type"=>"spelling", "mistake"=>"misspeellings", "correction"=>"misspellings"}, 7=>{"position"=>13, "error_type"=>"punctuation", "mistake"=>"!", "correction"=>"."}})
185
+ end
186
+
163
187
  it 'Counts the number of mistakes' do
164
188
  expect(@cc.number_of_mistakes).to eq(8)
165
189
  end
@@ -180,6 +204,10 @@ RSpec.describe ChatCorrect::Correct do
180
204
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"a", "type"=>"no_mistake"}, 3=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 4=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 5=>{"token"=>"double", "type"=>"no_mistake"}, 6=>{"token"=>"word", "type"=>"no_mistake"}, 7=>{"token"=>"check", "type"=>"no_mistake"}, 8=>{"token"=>".", "type"=>"no_mistake"}})
181
205
  end
182
206
 
207
+ it 'Reports the mistakes' do
208
+ expect(@cc.mistakes).to eq({0=>{"position"=>3, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>"double"}, 1=>{"position"=>4, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>""}})
209
+ end
210
+
183
211
  it 'Counts the number of mistakes' do
184
212
  expect(@cc.number_of_mistakes).to eq(2)
185
213
  end
@@ -200,6 +228,10 @@ RSpec.describe ChatCorrect::Correct do
200
228
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"and", "type"=>"no_mistake"}, 3=>{"token"=>"this", "type"=>"no_mistake"}, 4=>{"token"=>"and", "type"=>"no_mistake"}, 5=>{"token"=>"this", "type"=>"no_mistake"}, 6=>{"token"=>"is", "type"=>"no_mistake"}, 7=>{"token"=>"a", "type"=>"no_mistake"}, 8=>{"token"=>"correct", "type"=>"no_mistake"}, 9=>{"token"=>"double", "type"=>"no_mistake"}, 10=>{"token"=>"word", "type"=>"no_mistake"}, 11=>{"token"=>"check", "type"=>"no_mistake"}, 12=>{"token"=>"!", "type"=>"punctuation_mistake"}, 13=>{"token"=>".", "type"=>"punctuation_correction"}})
201
229
  end
202
230
 
231
+ it 'Reports the mistakes' do
232
+ expect(@cc.mistakes).to eq({0=>{"position"=>12, "error_type"=>"punctuation", "mistake"=>"!", "correction"=>"."}})
233
+ end
234
+
203
235
  it 'Counts the number of mistakes' do
204
236
  expect(@cc.number_of_mistakes).to eq(1)
205
237
  end
@@ -220,6 +252,10 @@ RSpec.describe ChatCorrect::Correct do
220
252
  expect(@cc.correct).to eq({0=>{"token"=>"He", "type"=>"no_mistake"}, 1=>{"token"=>"said", "type"=>"no_mistake"}, 2=>{"token"=>",", "type"=>"no_mistake"}, 3=>{"token"=>"\"", "type"=>"no_mistake"}, 4=>{"token"=>"Shhe", "type"=>"spelling_mistake"}, 5=>{"token"=>"She", "type"=>"spelling_correction"}, 6=>{"token"=>"is", "type"=>"no_mistake"}, 7=>{"token"=>"a", "type"=>"no_mistake"}, 8=>{"token"=>"crazy", "type"=>"no_mistake"}, 9=>{"token"=>"girl", "type"=>"no_mistake"}, 10=>{"token"=>".", "type"=>"word_order_mistake"}, 11=>{"token"=>"\"", "type"=>"word_order_mistake"}})
221
253
  end
222
254
 
255
+ it 'Reports the mistakes' do
256
+ expect(@cc.mistakes).to eq({0=>{"position"=>4, "error_type"=>"spelling", "mistake"=>"Shhe", "correction"=>"She"}, 1=>{"position"=>10, "error_type"=>"word_order", "mistake"=>"\"", "correction"=>"N/A"}, 2=>{"position"=>11, "error_type"=>"word_order", "mistake"=>".", "correction"=>"N/A"}})
257
+ end
258
+
223
259
  it 'Counts the number of mistakes' do
224
260
  expect(@cc.number_of_mistakes).to eq(3)
225
261
  end
@@ -240,6 +276,10 @@ RSpec.describe ChatCorrect::Correct do
240
276
  expect(@cc.correct).to eq({0=>{"token"=>"Test", "type"=>"no_mistake"}, 1=>{"token"=>"the", "type"=>"no_mistake"}, 2=>{"token"=>"word", "type"=>"word_order_mistake"}, 3=>{"token"=>"order", "type"=>"word_order_mistake"}, 4=>{"token"=>".", "type"=>"no_mistake"}})
241
277
  end
242
278
 
279
+ it 'Reports the mistakes' do
280
+ expect(@cc.mistakes).to eq({0=>{"position"=>2, "error_type"=>"word_order", "mistake"=>"order", "correction"=>"N/A"}, 1=>{"position"=>3, "error_type"=>"word_order", "mistake"=>"word", "correction"=>"N/A"}})
281
+ end
282
+
243
283
  it 'Counts the number of mistakes' do
244
284
  expect(@cc.number_of_mistakes).to eq(2)
245
285
  end
@@ -260,6 +300,10 @@ RSpec.describe ChatCorrect::Correct do
260
300
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"a", "type"=>"no_mistake"}, 3=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 4=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 5=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 6=>{"token"=>"double", "type"=>"no_mistake"}, 7=>{"token"=>"word", "type"=>"no_mistake"}, 8=>{"token"=>"check", "type"=>"no_mistake"}, 9=>{"token"=>".", "type"=>"no_mistake"}})
261
301
  end
262
302
 
303
+ it 'Reports the mistakes' do
304
+ expect(@cc.mistakes).to eq({0=>{"position"=>3, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>"double"}, 1=>{"position"=>4, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>"double"}, 2=>{"position"=>5, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>""}})
305
+ end
306
+
263
307
  it 'Counts the number of mistakes' do
264
308
  expect(@cc.number_of_mistakes).to eq(3)
265
309
  end
@@ -280,13 +324,17 @@ RSpec.describe ChatCorrect::Correct do
280
324
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"call", "type"=>"verb_mistake"}, 2=>{"token"=>"will call", "type"=>"verb_correction"}, 3=>{"token"=>"my", "type"=>"no_mistake"}, 4=>{"token"=>"mom", "type"=>"no_mistake"}, 5=>{"token"=>"tomorrow", "type"=>"no_mistake"}, 6=>{"token"=>".", "type"=>"no_mistake"}})
281
325
  end
282
326
 
283
- # it 'Counts the number of mistakes' do
284
- # expect(@cc.number_of_mistakes).to eq([])
285
- # end
327
+ it 'Reports the mistakes' do
328
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"verb", "mistake"=>"call", "correction"=>"will call"}})
329
+ end
286
330
 
287
- # it 'Reports the mistakes by mistake type' do
288
- # expect(@cc.mistake_report).to eq([])
289
- # end
331
+ it 'Counts the number of mistakes' do
332
+ expect(@cc.number_of_mistakes).to eq(1)
333
+ end
334
+
335
+ it 'Reports the mistakes by mistake type' do
336
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>1, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
337
+ end
290
338
  end
291
339
 
292
340
  context "example correction #015" do
@@ -300,13 +348,17 @@ RSpec.describe ChatCorrect::Correct do
300
348
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"flied", "type"=>"verb_mistake"}, 2=>{"token"=>"flew", "type"=>"verb_correction"}, 3=>{"token"=>"home", "type"=>"no_mistake"}, 4=>{"token"=>"yesterday", "type"=>"no_mistake"}, 5=>{"token"=>".", "type"=>"no_mistake"}})
301
349
  end
302
350
 
303
- # it 'Counts the number of mistakes' do
304
- # expect(@cc.number_of_mistakes).to eq([])
305
- # end
351
+ it 'Reports the mistakes' do
352
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"verb", "mistake"=>"flied", "correction"=>"flew"}})
353
+ end
306
354
 
307
- # it 'Reports the mistakes by mistake type' do
308
- # expect(@cc.mistake_report).to eq([])
309
- # end
355
+ it 'Counts the number of mistakes' do
356
+ expect(@cc.number_of_mistakes).to eq(1)
357
+ end
358
+
359
+ it 'Reports the mistakes by mistake type' do
360
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>1, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
361
+ end
310
362
  end
311
363
 
312
364
  context "example correction #016" do
@@ -320,13 +372,17 @@ RSpec.describe ChatCorrect::Correct do
320
372
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"shouldn't", "type"=>"no_mistake"}, 2=>{"token"=>"be", "type"=>"no_mistake"}, 3=>{"token"=>"use", "type"=>"verb_mistake"}, 4=>{"token"=>"used", "type"=>"verb_correction"}, 5=>{"token"=>"to", "type"=>"no_mistake"}, 6=>{"token"=>"test", "type"=>"no_mistake"}, 7=>{"token"=>"contractions", "type"=>"no_mistake"}, 8=>{"token"=>",", "type"=>"no_mistake"}, 9=>{"token"=>"but", "type"=>"no_mistake"}, 10=>{"token"=>"couln't", "type"=>"spelling_mistake"}, 11=>{"token"=>"couldn't", "type"=>"spelling_correction"}, 12=>{"token"=>"it", "type"=>"no_mistake"}, 13=>{"token"=>"?", "type"=>"no_mistake"}})
321
373
  end
322
374
 
323
- # it 'Counts the number of mistakes' do
324
- # expect(@cc.number_of_mistakes).to eq([])
325
- # end
375
+ it 'Reports the mistakes' do
376
+ expect(@cc.mistakes).to eq({0=>{"position"=>3, "error_type"=>"verb", "mistake"=>"use", "correction"=>"used"}, 1=>{"position"=>10, "error_type"=>"spelling", "mistake"=>"couln't", "correction"=>"couldn't"}})
377
+ end
326
378
 
327
- # it 'Reports the mistakes by mistake type' do
328
- # expect(@cc.mistake_report).to eq([])
329
- # end
379
+ it 'Counts the number of mistakes' do
380
+ expect(@cc.number_of_mistakes).to eq(2)
381
+ end
382
+
383
+ it 'Reports the mistakes by mistake type' do
384
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>1, "verb"=>1, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
385
+ end
330
386
  end
331
387
 
332
388
  context "example correction #017" do
@@ -340,13 +396,17 @@ RSpec.describe ChatCorrect::Correct do
340
396
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"to", "type"=>"no_mistake"}, 3=>{"token"=>"test", "type"=>"no_mistake"}, 4=>{"token"=>",", "type"=>"no_mistake"}, 5=>{"token"=>"'", "type"=>"no_mistake"}, 6=>{"token"=>"single", "type"=>"capitalization_mistake"}, 7=>{"token"=>"Single", "type"=>"capitalization_correction"}, 8=>{"token"=>"quotes", "type"=>"no_mistake"}, 9=>{"token"=>".", "type"=>"word_order_mistake"}, 10=>{"token"=>"'", "type"=>"word_order_mistake"}})
341
397
  end
342
398
 
343
- # it 'Counts the number of mistakes' do
344
- # expect(@cc.number_of_mistakes).to eq([])
345
- # end
399
+ it 'Reports the mistakes' do
400
+ expect(@cc.mistakes).to eq({0=>{"position"=>6, "error_type"=>"capitalization", "mistake"=>"single", "correction"=>"Single"}, 1=>{"position"=>9, "error_type"=>"word_order", "mistake"=>"'", "correction"=>"N/A"}, 2=>{"position"=>10, "error_type"=>"word_order", "mistake"=>".", "correction"=>"N/A"}})
401
+ end
346
402
 
347
- # it 'Reports the mistakes by mistake type' do
348
- # expect(@cc.mistake_report).to eq([])
349
- # end
403
+ it 'Counts the number of mistakes' do
404
+ expect(@cc.number_of_mistakes).to eq(3)
405
+ end
406
+
407
+ it 'Reports the mistakes by mistake type' do
408
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>0, "word_order"=>2, "capitalization"=>1, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
409
+ end
350
410
  end
351
411
 
352
412
  context "example correction #018" do
@@ -360,13 +420,17 @@ RSpec.describe ChatCorrect::Correct do
360
420
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"to", "type"=>"no_mistake"}, 3=>{"token"=>"test", "type"=>"no_mistake"}, 4=>{"token"=>"quotations", "type"=>"no_mistake"}, 5=>{"token"=>"\"", "type"=>"punctuation_mistake"}, 6=>{"token"=>"again", "type"=>"no_mistake"}, 7=>{"token"=>"\"", "type"=>"punctuation_mistake"}})
361
421
  end
362
422
 
363
- # it 'Counts the number of mistakes' do
364
- # expect(@cc.number_of_mistakes).to eq([])
365
- # end
423
+ it 'Reports the mistakes' do
424
+ expect(@cc.mistakes).to eq({0=>{"position"=>5, "error_type"=>"punctuation", "mistake"=>"\"", "correction"=>""}, 1=>{"position"=>7, "error_type"=>"punctuation", "mistake"=>"\""}})
425
+ end
366
426
 
367
- # it 'Reports the mistakes by mistake type' do
368
- # expect(@cc.mistake_report).to eq([])
369
- # end
427
+ it 'Counts the number of mistakes' do
428
+ expect(@cc.number_of_mistakes).to eq(2)
429
+ end
430
+
431
+ it 'Reports the mistakes by mistake type' do
432
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>2, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
433
+ end
370
434
  end
371
435
 
372
436
  context "example correction #019" do
@@ -380,13 +444,17 @@ RSpec.describe ChatCorrect::Correct do
380
444
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"will call", "type"=>"verb_mistake"}, 2=>{"token"=>"called", "type"=>"verb_correction"}, 3=>{"token"=>"my", "type"=>"no_mistake"}, 4=>{"token"=>"mom", "type"=>"no_mistake"}, 5=>{"token"=>"yesterday", "type"=>"no_mistake"}, 6=>{"token"=>".", "type"=>"no_mistake"}})
381
445
  end
382
446
 
383
- # it 'Counts the number of mistakes' do
384
- # expect(@cc.number_of_mistakes).to eq([])
385
- # end
447
+ it 'Reports the mistakes' do
448
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"verb", "mistake"=>"will call", "correction"=>"called"}})
449
+ end
386
450
 
387
- # it 'Reports the mistakes by mistake type' do
388
- # expect(@cc.mistake_report).to eq([])
389
- # end
451
+ it 'Counts the number of mistakes' do
452
+ expect(@cc.number_of_mistakes).to eq(1)
453
+ end
454
+
455
+ it 'Reports the mistakes by mistake type' do
456
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>1, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
457
+ end
390
458
  end
391
459
 
392
460
  context "example correction #020" do
@@ -400,13 +468,17 @@ RSpec.describe ChatCorrect::Correct do
400
468
  expect(@cc.correct).to eq({0=>{"token"=>"Test", "type"=>"no_mistake"}, 1=>{"token"=>"run", "type"=>"unnecessary_word_mistake"}, 2=>{"token"=>"the", "type"=>"no_mistake"}, 3=>{"token"=>"word", "type"=>"word_order_mistake"}, 4=>{"token"=>"order", "type"=>"word_order_mistake"}, 5=>{"token"=>"with", "type"=>"no_mistake"}, 6=>{"token"=>"anotther", "type"=>"spelling_mistake"}, 7=>{"token"=>"another", "type"=>"spelling_correction"}, 8=>{"token"=>"simple", "type"=>"missing_word_mistake"}, 9=>{"token"=>"mistake", "type"=>"no_mistake"}, 10=>{"token"=>".", "type"=>"no_mistake"}})
401
469
  end
402
470
 
403
- # it 'Counts the number of mistakes' do
404
- # expect(@cc.number_of_mistakes).to eq([])
405
- # end
471
+ it 'Reports the mistakes' do
472
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"unnecessary_word", "mistake"=>"run", "correction"=>""}, 1=>{"position"=>3, "error_type"=>"word_order", "mistake"=>"order", "correction"=>"N/A"}, 2=>{"position"=>4, "error_type"=>"word_order", "mistake"=>"word", "correction"=>"N/A"}, 3=>{"position"=>6, "error_type"=>"spelling", "mistake"=>"anotther", "correction"=>"another"}, 4=>{"position"=>8, "error_type"=>"missing_word", "mistake"=>"simple", "correction"=>""}})
473
+ end
406
474
 
407
- # it 'Reports the mistakes by mistake type' do
408
- # expect(@cc.mistake_report).to eq([])
409
- # end
475
+ it 'Counts the number of mistakes' do
476
+ expect(@cc.number_of_mistakes).to eq(5)
477
+ end
478
+
479
+ it 'Reports the mistakes by mistake type' do
480
+ expect(@cc.mistake_report).to eq({"missing_word"=>1, "unnecessary_word"=>1, "spelling"=>1, "verb"=>0, "punctuation"=>0, "word_order"=>2, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
481
+ end
410
482
  end
411
483
 
412
484
  context "example correction #021" do
@@ -420,13 +492,17 @@ RSpec.describe ChatCorrect::Correct do
420
492
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"to", "type"=>"no_mistake"}, 3=>{"token"=>"test", "type"=>"no_mistake"}, 4=>{"token"=>"quotations", "type"=>"no_mistake"}, 5=>{"token"=>"\"", "type"=>"punctuation_mistake"}, 6=>{"token"=>"again", "type"=>"no_mistake"}, 7=>{"token"=>"\"", "type"=>"punctuation_mistake"}, 8=>{"token"=>".", "type"=>"no_mistake"}})
421
493
  end
422
494
 
423
- # it 'Counts the number of mistakes' do
424
- # expect(@cc.number_of_mistakes).to eq([])
425
- # end
495
+ it 'Reports the mistakes' do
496
+ expect(@cc.mistakes).to eq({0=>{"position"=>5, "error_type"=>"punctuation", "mistake"=>"\"", "correction"=>""}, 1=>{"position"=>7, "error_type"=>"punctuation", "mistake"=>"\"", "correction"=>""}})
497
+ end
426
498
 
427
- # it 'Reports the mistakes by mistake type' do
428
- # expect(@cc.mistake_report).to eq([])
429
- # end
499
+ it 'Counts the number of mistakes' do
500
+ expect(@cc.number_of_mistakes).to eq(2)
501
+ end
502
+
503
+ it 'Reports the mistakes by mistake type' do
504
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>2, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
505
+ end
430
506
  end
431
507
 
432
508
  context "example correction #022" do
@@ -440,13 +516,17 @@ RSpec.describe ChatCorrect::Correct do
440
516
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"to", "type"=>"no_mistake"}, 3=>{"token"=>"test", "type"=>"no_mistake"}, 4=>{"token"=>"quotations", "type"=>"no_mistake"}, 5=>{"token"=>"\"", "type"=>"punctuation_mistake"}, 6=>{"token"=>"again", "type"=>"no_mistake"}, 7=>{"token"=>"\"", "type"=>"punctuation_mistake"}, 8=>{"token"=>".", "type"=>"punctuation_correction"}})
441
517
  end
442
518
 
443
- # it 'Counts the number of mistakes' do
444
- # expect(@cc.number_of_mistakes).to eq([])
445
- # end
519
+ it 'Reports the mistakes' do
520
+ expect(@cc.mistakes).to eq({0=>{"position"=>5, "error_type"=>"punctuation", "mistake"=>"\"", "correction"=>""}, 1=>{"position"=>7, "error_type"=>"punctuation", "mistake"=>"\"", "correction"=>"."}})
521
+ end
446
522
 
447
- # it 'Reports the mistakes by mistake type' do
448
- # expect(@cc.mistake_report).to eq([])
449
- # end
523
+ it 'Counts the number of mistakes' do
524
+ expect(@cc.number_of_mistakes).to eq(2)
525
+ end
526
+
527
+ it 'Reports the mistakes by mistake type' do
528
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>2, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
529
+ end
450
530
  end
451
531
 
452
532
  context "example correction #023" do
@@ -460,13 +540,17 @@ RSpec.describe ChatCorrect::Correct do
460
540
  expect(@cc.correct).to eq({0=>{"token"=>"He", "type"=>"no_mistake"}, 1=>{"token"=>"didn't realize", "type"=>"verb_mistake"}, 2=>{"token"=>"hadn't realized", "type"=>"verb_correction"}, 3=>{"token"=>"that", "type"=>"no_mistake"}, 4=>{"token"=>"he", "type"=>"no_mistake"}, 5=>{"token"=>"should", "type"=>"no_mistake"}, 6=>{"token"=>"had changed", "type"=>"verb_mistake"}, 7=>{"token"=>"have changed", "type"=>"verb_correction"}, 8=>{"token"=>"the", "type"=>"no_mistake"}, 9=>{"token"=>"locks", "type"=>"no_mistake"}, 10=>{"token"=>".", "type"=>"no_mistake"}})
461
541
  end
462
542
 
463
- # it 'Counts the number of mistakes' do
464
- # expect(@cc.number_of_mistakes).to eq([])
465
- # end
543
+ it 'Reports the mistakes' do
544
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"verb", "mistake"=>"didn't realize", "correction"=>"hadn't realized"}, 1=>{"position"=>6, "error_type"=>"verb", "mistake"=>"had changed", "correction"=>"have changed"}})
545
+ end
466
546
 
467
- # it 'Reports the mistakes by mistake type' do
468
- # expect(@cc.mistake_report).to eq([])
469
- # end
547
+ it 'Counts the number of mistakes' do
548
+ expect(@cc.number_of_mistakes).to eq(2)
549
+ end
550
+
551
+ it 'Reports the mistakes by mistake type' do
552
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>2, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
553
+ end
470
554
  end
471
555
 
472
556
  context "example correction #024" do
@@ -480,13 +564,17 @@ RSpec.describe ChatCorrect::Correct do
480
564
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"will call", "type"=>"verb_mistake"}, 2=>{"token"=>"would have called", "type"=>"verb_correction"}, 3=>{"token"=>"my", "type"=>"no_mistake"}, 4=>{"token"=>"mom", "type"=>"no_mistake"}, 5=>{"token"=>"yesterday", "type"=>"no_mistake"}, 6=>{"token"=>"if", "type"=>"no_mistake"}, 7=>{"token"=>"I", "type"=>"no_mistake"}, 8=>{"token"=>"had", "type"=>"no_mistake"}, 9=>{"token"=>"had", "type"=>"missing_word_mistake"}, 10=>{"token"=>"time", "type"=>"no_mistake"}, 11=>{"token"=>".", "type"=>"no_mistake"}})
481
565
  end
482
566
 
483
- # it 'Counts the number of mistakes' do
484
- # expect(@cc.number_of_mistakes).to eq([])
485
- # end
567
+ it 'Reports the mistakes' do
568
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"verb", "mistake"=>"will call", "correction"=>"would have called"}, 1=>{"position"=>9, "error_type"=>"missing_word", "mistake"=>"had", "correction"=>""}})
569
+ end
486
570
 
487
- # it 'Reports the mistakes by mistake type' do
488
- # expect(@cc.mistake_report).to eq([])
489
- # end
571
+ it 'Counts the number of mistakes' do
572
+ expect(@cc.number_of_mistakes).to eq(2)
573
+ end
574
+
575
+ it 'Reports the mistakes by mistake type' do
576
+ expect(@cc.mistake_report).to eq({"missing_word"=>1, "unnecessary_word"=>0, "spelling"=>0, "verb"=>1, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
577
+ end
490
578
  end
491
579
 
492
580
  context "example correction #025" do
@@ -500,13 +588,17 @@ RSpec.describe ChatCorrect::Correct do
500
588
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"call", "type"=>"verb_mistake"}, 2=>{"token"=>"would have called", "type"=>"verb_correction"}, 3=>{"token"=>"my", "type"=>"no_mistake"}, 4=>{"token"=>"mom", "type"=>"no_mistake"}, 5=>{"token"=>"yesterday", "type"=>"no_mistake"}, 6=>{"token"=>".", "type"=>"no_mistake"}})
501
589
  end
502
590
 
503
- # it 'Counts the number of mistakes' do
504
- # expect(@cc.number_of_mistakes).to eq([])
505
- # end
591
+ it 'Reports the mistakes' do
592
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"verb", "mistake"=>"call", "correction"=>"would have called"}})
593
+ end
506
594
 
507
- # it 'Reports the mistakes by mistake type' do
508
- # expect(@cc.mistake_report).to eq([])
509
- # end
595
+ it 'Counts the number of mistakes' do
596
+ expect(@cc.number_of_mistakes).to eq(1)
597
+ end
598
+
599
+ it 'Reports the mistakes by mistake type' do
600
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>1, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
601
+ end
510
602
  end
511
603
 
512
604
  context "example correction #026" do
@@ -520,13 +612,17 @@ RSpec.describe ChatCorrect::Correct do
520
612
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"singed", "type"=>"verb_mistake"}, 2=>{"token"=>"sang", "type"=>"verb_correction"}, 3=>{"token"=>"at", "type"=>"no_mistake"}, 4=>{"token"=>"the", "type"=>"no_mistake"}, 5=>{"token"=>"karaoke", "type"=>"no_mistake"}, 6=>{"token"=>"bar", "type"=>"no_mistake"}, 7=>{"token"=>".", "type"=>"no_mistake"}})
521
613
  end
522
614
 
523
- # it 'Counts the number of mistakes' do
524
- # expect(@cc.number_of_mistakes).to eq([])
525
- # end
615
+ it 'Reports the mistakes' do
616
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"verb", "mistake"=>"singed", "correction"=>"sang"}})
617
+ end
526
618
 
527
- # it 'Reports the mistakes by mistake type' do
528
- # expect(@cc.mistake_report).to eq([])
529
- # end
619
+ it 'Counts the number of mistakes' do
620
+ expect(@cc.number_of_mistakes).to eq(1)
621
+ end
622
+
623
+ it 'Reports the mistakes by mistake type' do
624
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>1, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
625
+ end
530
626
  end
531
627
 
532
628
  context "example correction #027" do
@@ -540,13 +636,17 @@ RSpec.describe ChatCorrect::Correct do
540
636
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"flied", "type"=>"verb_mistake"}, 2=>{"token"=>"flew", "type"=>"verb_correction"}, 3=>{"token"=>"to", "type"=>"no_mistake"}, 4=>{"token"=>"California", "type"=>"no_mistake"}, 5=>{"token"=>"and", "type"=>"no_mistake"}, 6=>{"token"=>"go", "type"=>"verb_mistake"}, 7=>{"token"=>"went", "type"=>"verb_correction"}, 8=>{"token"=>"to", "type"=>"no_mistake"}, 9=>{"token"=>"the", "type"=>"missing_word_mistake"}, 10=>{"token"=>"zoo", "type"=>"no_mistake"}, 11=>{"token"=>".", "type"=>"no_mistake"}})
541
637
  end
542
638
 
543
- # it 'Counts the number of mistakes' do
544
- # expect(@cc.number_of_mistakes).to eq([])
545
- # end
639
+ it 'Reports the mistakes' do
640
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"verb", "mistake"=>"flied", "correction"=>"flew"}, 1=>{"position"=>6, "error_type"=>"verb", "mistake"=>"go", "correction"=>"went"}, 2=>{"position"=>9, "error_type"=>"missing_word", "mistake"=>"the", "correction"=>""}})
641
+ end
546
642
 
547
- # it 'Reports the mistakes by mistake type' do
548
- # expect(@cc.mistake_report).to eq([])
549
- # end
643
+ it 'Counts the number of mistakes' do
644
+ expect(@cc.number_of_mistakes).to eq(3)
645
+ end
646
+
647
+ it 'Reports the mistakes by mistake type' do
648
+ expect(@cc.mistake_report).to eq({"missing_word"=>1, "unnecessary_word"=>0, "spelling"=>0, "verb"=>2, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
649
+ end
550
650
  end
551
651
 
552
652
  context "example correction #028" do
@@ -560,13 +660,17 @@ RSpec.describe ChatCorrect::Correct do
560
660
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"a", "type"=>"no_mistake"}, 3=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 4=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 5=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 6=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 7=>{"token"=>"double", "type"=>"no_mistake"}, 8=>{"token"=>"word", "type"=>"no_mistake"}, 9=>{"token"=>"check", "type"=>"no_mistake"}, 10=>{"token"=>".", "type"=>"no_mistake"}})
561
661
  end
562
662
 
563
- # it 'Counts the number of mistakes' do
564
- # expect(@cc.number_of_mistakes).to eq([])
565
- # end
663
+ it 'Reports the mistakes' do
664
+ expect(@cc.mistakes).to eq({0=>{"position"=>3, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>"double"}, 1=>{"position"=>4, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>"double"}, 2=>{"position"=>5, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>"double"}, 3=>{"position"=>6, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>""}})
665
+ end
566
666
 
567
- # it 'Reports the mistakes by mistake type' do
568
- # expect(@cc.mistake_report).to eq([])
569
- # end
667
+ it 'Counts the number of mistakes' do
668
+ expect(@cc.number_of_mistakes).to eq(4)
669
+ end
670
+
671
+ it 'Reports the mistakes by mistake type' do
672
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>4, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
673
+ end
570
674
  end
571
675
 
572
676
  context "example correction #029" do
@@ -580,13 +684,17 @@ RSpec.describe ChatCorrect::Correct do
580
684
  expect(@cc.correct).to eq({0=>{"token"=>"This", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"a", "type"=>"no_mistake"}, 3=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 4=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 5=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 6=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 7=>{"token"=>"double", "type"=>"duplicate_word_mistake"}, 8=>{"token"=>"double", "type"=>"no_mistake"}, 9=>{"token"=>"word", "type"=>"no_mistake"}, 10=>{"token"=>"check", "type"=>"no_mistake"}, 11=>{"token"=>".", "type"=>"no_mistake"}})
581
685
  end
582
686
 
583
- # it 'Counts the number of mistakes' do
584
- # expect(@cc.number_of_mistakes).to eq([])
585
- # end
687
+ it 'Reports the mistakes' do
688
+ expect(@cc.mistakes).to eq({0=>{"position"=>3, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>"double"}, 1=>{"position"=>4, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>"double"}, 2=>{"position"=>5, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>"double"}, 3=>{"position"=>6, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>"double"}, 4=>{"position"=>7, "error_type"=>"duplicate_word", "mistake"=>"double", "correction"=>""}})
689
+ end
586
690
 
587
- # it 'Reports the mistakes by mistake type' do
588
- # expect(@cc.mistake_report).to eq([])
589
- # end
691
+ it 'Counts the number of mistakes' do
692
+ expect(@cc.number_of_mistakes).to eq(5)
693
+ end
694
+
695
+ it 'Reports the mistakes by mistake type' do
696
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>5, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
697
+ end
590
698
  end
591
699
 
592
700
  context "example correction #030" do
@@ -600,13 +708,17 @@ RSpec.describe ChatCorrect::Correct do
600
708
  expect(@cc.correct).to eq({0=>{"token"=>"If", "type"=>"no_mistake"}, 1=>{"token"=>"my", "type"=>"no_mistake"}, 2=>{"token"=>"school", "type"=>"no_mistake"}, 3=>{"token"=>"were located", "type"=>"no_mistake"}, 4=>{"token"=>"in", "type"=>"no_mistake"}, 5=>{"token"=>"Tokyo", "type"=>"no_mistake"}, 6=>{"token"=>",", "type"=>"no_mistake"}, 7=>{"token"=>"the", "type"=>"missing_word_mistake"}, 8=>{"token"=>"situation", "type"=>"no_mistake"}, 9=>{"token"=>"would have", "type"=>"verb_mistake"}, 10=>{"token"=>"would have been", "type"=>"verb_correction"}, 11=>{"token"=>"quite", "type"=>"no_mistake"}, 12=>{"token"=>"changed", "type"=>"word_choice_mistake"}, 13=>{"token"=>"different", "type"=>"word_choice_correction"}, 14=>{"token"=>".", "type"=>"no_mistake"}})
601
709
  end
602
710
 
603
- # it 'Counts the number of mistakes' do
604
- # expect(@cc.number_of_mistakes).to eq([])
605
- # end
711
+ it 'Reports the mistakes' do
712
+ expect(@cc.mistakes).to eq({0=>{"position"=>7, "error_type"=>"missing_word", "mistake"=>"the", "correction"=>""}, 1=>{"position"=>9, "error_type"=>"verb", "mistake"=>"would have", "correction"=>"would have been"}, 2=>{"position"=>12, "error_type"=>"word_choice", "mistake"=>"changed", "correction"=>"different"}})
713
+ end
606
714
 
607
- # it 'Reports the mistakes by mistake type' do
608
- # expect(@cc.mistake_report).to eq([])
609
- # end
715
+ it 'Counts the number of mistakes' do
716
+ expect(@cc.number_of_mistakes).to eq(3)
717
+ end
718
+
719
+ it 'Reports the mistakes by mistake type' do
720
+ expect(@cc.mistake_report).to eq({"missing_word"=>1, "unnecessary_word"=>0, "spelling"=>0, "verb"=>1, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>1, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
721
+ end
610
722
  end
611
723
 
612
724
  context "example correction #031" do
@@ -616,17 +728,21 @@ RSpec.describe ChatCorrect::Correct do
616
728
  @cc = ChatCorrect::Correct.new(original_sentence: original_sentence, corrected_sentence: corrected_sentence)
617
729
  end
618
730
 
619
- it 'Annotates the corrections' do
620
- expect(@cc.correct).to eq({0=>{"token"=>"However", "type"=>"no_mistake"}, 1=>{"token"=>",", "type"=>"no_mistake"}, 2=>{"token"=>"under", "type"=>"missing_word_mistake"}, 3=>{"token"=>"normal", "type"=>"missing_word_mistake"}, 4=>{"token"=>"circumstances", "type"=>"missing_word_mistake"}, 5=>{"token"=>",", "type"=>"punctuation_mistake"}, 6=>{"token"=>"I", "type"=>"no_mistake"}, 7=>{"token"=>"think", "type"=>"no_mistake"}, 8=>{"token"=>"a", "type"=>"unnecessary_word_mistake"}, 9=>{"token"=>"success", "type"=>"no_mistake"}, 10=>{"token"=>"in", "type"=>"no_mistake"}, 11=>{"token"=>"life", "type"=>"no_mistake"}, 12=>{"token"=>"comes", "type"=>"no_mistake"}, 13=>{"token"=>"from", "type"=>"no_mistake"}, 14=>{"token"=>"careful", "type"=>"no_mistake"}, 15=>{"token"=>"planning", "type"=>"no_mistake"}, 16=>{"token"=>"when", "type"=>"unnecessary_word_mistake"}, 17=>{"token"=>"it", "type"=>"unnecessary_word_mistake"}, 18=>{"token"=>"is", "type"=>"unnecessary_word_mistake"}, 19=>{"token"=>"a", "type"=>"unnecessary_word_mistake"}, 20=>{"token"=>"usual", "type"=>"unnecessary_word_mistake"}, 21=>{"token"=>"situation", "type"=>"unnecessary_word_mistake"}, 22=>{"token"=>".", "type"=>"no_mistake"}})
731
+ it 'Annotates the corrections' do
732
+ expect(@cc.correct).to eq({0=>{"token"=>"However", "type"=>"no_mistake"}, 1=>{"token"=>",", "type"=>"no_mistake"}, 2=>{"token"=>"under", "type"=>"missing_word_mistake"}, 3=>{"token"=>"normal", "type"=>"missing_word_mistake"}, 4=>{"token"=>"circumstances", "type"=>"missing_word_mistake"}, 5=>{"token"=>",", "type"=>"punctuation_mistake"}, 6=>{"token"=>"I", "type"=>"no_mistake"}, 7=>{"token"=>"think", "type"=>"no_mistake"}, 8=>{"token"=>"a", "type"=>"unnecessary_word_mistake"}, 9=>{"token"=>"success", "type"=>"no_mistake"}, 10=>{"token"=>"in", "type"=>"no_mistake"}, 11=>{"token"=>"life", "type"=>"no_mistake"}, 12=>{"token"=>"comes", "type"=>"no_mistake"}, 13=>{"token"=>"from", "type"=>"no_mistake"}, 14=>{"token"=>"careful", "type"=>"no_mistake"}, 15=>{"token"=>"planning", "type"=>"no_mistake"}, 16=>{"token"=>"when", "type"=>"unnecessary_word_mistake"}, 17=>{"token"=>"it", "type"=>"unnecessary_word_mistake"}, 18=>{"token"=>"is", "type"=>"unnecessary_word_mistake"}, 19=>{"token"=>"a", "type"=>"unnecessary_word_mistake"}, 20=>{"token"=>"usual", "type"=>"unnecessary_word_mistake"}, 21=>{"token"=>"situation", "type"=>"unnecessary_word_mistake"}, 22=>{"token"=>".", "type"=>"no_mistake"}})
733
+ end
734
+
735
+ it 'Reports the mistakes' do
736
+ expect(@cc.mistakes).to eq({0=>{"position"=>2, "error_type"=>"missing_word", "mistake"=>"under", "correction"=>"normal"}, 1=>{"position"=>3, "error_type"=>"missing_word", "mistake"=>"normal", "correction"=>"circumstances"}, 2=>{"position"=>4, "error_type"=>"missing_word", "mistake"=>"circumstances", "correction"=>""}, 3=>{"position"=>5, "error_type"=>"punctuation", "mistake"=>",", "correction"=>""}, 4=>{"position"=>8, "error_type"=>"unnecessary_word", "mistake"=>"a", "correction"=>""}, 5=>{"position"=>16, "error_type"=>"unnecessary_word", "mistake"=>"when", "correction"=>"it"}, 6=>{"position"=>17, "error_type"=>"unnecessary_word", "mistake"=>"it", "correction"=>"is"}, 7=>{"position"=>18, "error_type"=>"unnecessary_word", "mistake"=>"is", "correction"=>"a"}, 8=>{"position"=>19, "error_type"=>"unnecessary_word", "mistake"=>"a", "correction"=>"usual"}, 9=>{"position"=>20, "error_type"=>"unnecessary_word", "mistake"=>"usual", "correction"=>"situation"}, 10=>{"position"=>21, "error_type"=>"unnecessary_word", "mistake"=>"situation", "correction"=>""}})
737
+ end
738
+
739
+ it 'Counts the number of mistakes' do
740
+ expect(@cc.number_of_mistakes).to eq(11)
621
741
  end
622
742
 
623
- # it 'Counts the number of mistakes' do
624
- # expect(@cc.number_of_mistakes).to eq([])
625
- # end
626
-
627
- # it 'Reports the mistakes by mistake type' do
628
- # expect(@cc.mistake_report).to eq([])
629
- # end
743
+ it 'Reports the mistakes by mistake type' do
744
+ expect(@cc.mistake_report).to eq({"missing_word"=>3, "unnecessary_word"=>7, "spelling"=>0, "verb"=>0, "punctuation"=>1, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
745
+ end
630
746
  end
631
747
 
632
748
  context "example correction #032" do
@@ -640,13 +756,17 @@ RSpec.describe ChatCorrect::Correct do
640
756
  expect(@cc.correct).to eq({0=>{"token"=>"He", "type"=>"no_mistake"}, 1=>{"token"=>"is", "type"=>"no_mistake"}, 2=>{"token"=>"super", "type"=>"no_mistake"}, 3=>{"token"=>"rad", "type"=>"word_choice_mistake"}, 4=>{"token"=>"cool", "type"=>"word_choice_correction"}, 5=>{"token"=>".", "type"=>"punctuation_mistake"}, 6=>{"token"=>"!", "type"=>"punctuation_correction"}})
641
757
  end
642
758
 
643
- # it 'Counts the number of mistakes' do
644
- # expect(@cc.number_of_mistakes).to eq([])
645
- # end
759
+ it 'Reports the mistakes' do
760
+ expect(@cc.mistakes).to eq({0=>{"position"=>3, "error_type"=>"word_choice", "mistake"=>"rad", "correction"=>"cool"}, 1=>{"position"=>5, "error_type"=>"punctuation", "mistake"=>".", "correction"=>"!"}})
761
+ end
646
762
 
647
- # it 'Reports the mistakes by mistake type' do
648
- # expect(@cc.mistake_report).to eq([])
649
- # end
763
+ it 'Counts the number of mistakes' do
764
+ expect(@cc.number_of_mistakes).to eq(2)
765
+ end
766
+
767
+ it 'Reports the mistakes by mistake type' do
768
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>1, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>1, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
769
+ end
650
770
  end
651
771
 
652
772
  context "example correction #033" do
@@ -660,13 +780,17 @@ RSpec.describe ChatCorrect::Correct do
660
780
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"was not going", "type"=>"verb_mistake"}, 2=>{"token"=>"did not go", "type"=>"verb_correction"}, 3=>{"token"=>"to", "type"=>"no_mistake"}, 4=>{"token"=>"the", "type"=>"no_mistake"}, 5=>{"token"=>"party", "type"=>"no_mistake"}, 6=>{"token"=>".", "type"=>"no_mistake"}})
661
781
  end
662
782
 
663
- # it 'Counts the number of mistakes' do
664
- # expect(@cc.number_of_mistakes).to eq([])
665
- # end
783
+ it 'Reports the mistakes' do
784
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"verb", "mistake"=>"was not going", "correction"=>"did not go"}})
785
+ end
666
786
 
667
- # it 'Reports the mistakes by mistake type' do
668
- # expect(@cc.mistake_report).to eq([])
669
- # end
787
+ it 'Counts the number of mistakes' do
788
+ expect(@cc.number_of_mistakes).to eq(1)
789
+ end
790
+
791
+ it 'Reports the mistakes by mistake type' do
792
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>1, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
793
+ end
670
794
  end
671
795
 
672
796
  context "example correction #034" do
@@ -680,13 +804,17 @@ RSpec.describe ChatCorrect::Correct do
680
804
  expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"had", "type"=>"no_mistake"}, 2=>{"token"=>"experiences", "type"=>"no_mistake"}, 3=>{"token"=>"to", "type"=>"word_choice_mistake"}, 4=>{"token"=>"which", "type"=>"word_choice_correction"}, 5=>{"token"=>"support", "type"=>"no_mistake"}, 6=>{"token"=>"my", "type"=>"no_mistake"}, 7=>{"token"=>"opinion", "type"=>"no_mistake"}, 8=>{"token"=>"which", "type"=>"unnecessary_word_mistake"}, 9=>{"token"=>"a", "type"=>"unnecessary_word_mistake"}, 10=>{"token"=>"that", "type"=>"missing_word_mistake"}, 11=>{"token"=>"success", "type"=>"no_mistake"}, 12=>{"token"=>"in", "type"=>"no_mistake"}, 13=>{"token"=>"life", "type"=>"no_mistake"}, 14=>{"token"=>"comes", "type"=>"no_mistake"}, 15=>{"token"=>"from", "type"=>"no_mistake"}, 16=>{"token"=>"careful", "type"=>"no_mistake"}, 17=>{"token"=>"planning", "type"=>"no_mistake"}, 18=>{"token"=>".", "type"=>"no_mistake"}})
681
805
  end
682
806
 
683
- # it 'Counts the number of mistakes' do
684
- # expect(@cc.number_of_mistakes).to eq([])
685
- # end
807
+ it 'Reports the mistakes' do
808
+ expect(@cc.mistakes).to eq({0=>{"position"=>3, "error_type"=>"word_choice", "mistake"=>"to", "correction"=>"which"}, 1=>{"position"=>8, "error_type"=>"unnecessary_word", "mistake"=>"which", "correction"=>"a"}, 2=>{"position"=>9, "error_type"=>"unnecessary_word", "mistake"=>"a", "correction"=>""}, 3=>{"position"=>10, "error_type"=>"missing_word", "mistake"=>"that", "correction"=>""}})
809
+ end
686
810
 
687
- # it 'Reports the mistakes by mistake type' do
688
- # expect(@cc.mistake_report).to eq([])
689
- # end
811
+ it 'Counts the number of mistakes' do
812
+ expect(@cc.number_of_mistakes).to eq(4)
813
+ end
814
+
815
+ it 'Reports the mistakes by mistake type' do
816
+ expect(@cc.mistake_report).to eq({"missing_word"=>1, "unnecessary_word"=>2, "spelling"=>0, "verb"=>0, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>1, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
817
+ end
690
818
  end
691
819
 
692
820
  context "example correction #035" do
@@ -700,13 +828,17 @@ RSpec.describe ChatCorrect::Correct do
700
828
  expect(@cc.correct).to eq({0=>{"token"=>"She", "type"=>"unnecessary_word_mistake"}, 1=>{"token"=>"have", "type"=>"unnecessary_word_mistake"}, 2=>{"token"=>"a", "type"=>"unnecessary_word_mistake"}, 3=>{"token"=>"good", "type"=>"unnecessary_word_mistake"}, 4=>{"token"=>"day", "type"=>"unnecessary_word_mistake"}, 5=>{"token"=>"yesterday", "type"=>"unnecessary_word_mistake"}, 6=>{"token"=>".", "type"=>"punctuation_mistake"}, 7=>{"token"=>"hello", "type"=>"missing_word_mistake"}, 8=>{"token"=>"world", "type"=>"missing_word_mistake"}})
701
829
  end
702
830
 
703
- # it 'Counts the number of mistakes' do
704
- # expect(@cc.number_of_mistakes).to eq([])
705
- # end
831
+ it 'Reports the mistakes' do
832
+ expect(@cc.mistakes).to eq({0=>{"position"=>0, "error_type"=>"unnecessary_word", "mistake"=>"She", "correction"=>"have"}, 1=>{"position"=>1, "error_type"=>"unnecessary_word", "mistake"=>"have", "correction"=>"a"}, 2=>{"position"=>2, "error_type"=>"unnecessary_word", "mistake"=>"a", "correction"=>"good"}, 3=>{"position"=>3, "error_type"=>"unnecessary_word", "mistake"=>"good", "correction"=>"day"}, 4=>{"position"=>4, "error_type"=>"unnecessary_word", "mistake"=>"day", "correction"=>"yesterday"}, 5=>{"position"=>5, "error_type"=>"unnecessary_word", "mistake"=>"yesterday", "correction"=>""}, 6=>{"position"=>6, "error_type"=>"punctuation", "mistake"=>".", "correction"=>""}, 7=>{"position"=>7, "error_type"=>"missing_word", "mistake"=>"hello", "correction"=>"world"}, 8=>{"position"=>8, "error_type"=>"missing_word", "mistake"=>"world"}})
833
+ end
706
834
 
707
- # it 'Reports the mistakes by mistake type' do
708
- # expect(@cc.mistake_report).to eq([])
709
- # end
835
+ it 'Counts the number of mistakes' do
836
+ expect(@cc.number_of_mistakes).to eq(9)
837
+ end
838
+
839
+ it 'Reports the mistakes by mistake type' do
840
+ expect(@cc.mistake_report).to eq({"missing_word"=>2, "unnecessary_word"=>6, "spelling"=>0, "verb"=>0, "punctuation"=>1, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
841
+ end
710
842
  end
711
843
 
712
844
  context "example correction #036" do
@@ -720,13 +852,17 @@ RSpec.describe ChatCorrect::Correct do
720
852
  expect(@cc.correct).to eq({0=>{"token"=>"If", "type"=>"no_mistake"}, 1=>{"token"=>"my", "type"=>"no_mistake"}, 2=>{"token"=>"school", "type"=>"no_mistake"}, 3=>{"token"=>"were located", "type"=>"verb_mistake"}, 4=>{"token"=>"had been located", "type"=>"verb_correction"}, 5=>{"token"=>"in", "type"=>"no_mistake"}, 6=>{"token"=>"Tokyo", "type"=>"no_mistake"}, 7=>{"token"=>",", "type"=>"no_mistake"}, 8=>{"token"=>"the", "type"=>"missing_word_mistake"}, 9=>{"token"=>"situation", "type"=>"no_mistake"}, 10=>{"token"=>"would have", "type"=>"verb_mistake"}, 11=>{"token"=>"would have been", "type"=>"verb_correction"}, 12=>{"token"=>"quite", "type"=>"no_mistake"}, 13=>{"token"=>"changed", "type"=>"word_choice_mistake"}, 14=>{"token"=>"different", "type"=>"word_choice_correction"}, 15=>{"token"=>".", "type"=>"no_mistake"}})
721
853
  end
722
854
 
723
- # it 'Counts the number of mistakes' do
724
- # expect(@cc.number_of_mistakes).to eq([])
725
- # end
855
+ it 'Reports the mistakes' do
856
+ expect(@cc.mistakes).to eq({0=>{"position"=>3, "error_type"=>"verb", "mistake"=>"were located", "correction"=>"had been located"}, 1=>{"position"=>8, "error_type"=>"missing_word", "mistake"=>"the", "correction"=>""}, 2=>{"position"=>10, "error_type"=>"verb", "mistake"=>"would have", "correction"=>"would have been"}, 3=>{"position"=>13, "error_type"=>"word_choice", "mistake"=>"changed", "correction"=>"different"}})
857
+ end
726
858
 
727
- # it 'Reports the mistakes by mistake type' do
728
- # expect(@cc.mistake_report).to eq([])
729
- # end
859
+ it 'Counts the number of mistakes' do
860
+ expect(@cc.number_of_mistakes).to eq(4)
861
+ end
862
+
863
+ it 'Reports the mistakes by mistake type' do
864
+ expect(@cc.mistake_report).to eq({"missing_word"=>1, "unnecessary_word"=>0, "spelling"=>0, "verb"=>2, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>1, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
865
+ end
730
866
  end
731
867
 
732
868
  context "example correction #037" do
@@ -737,16 +873,20 @@ RSpec.describe ChatCorrect::Correct do
737
873
  end
738
874
 
739
875
  it 'Annotates the corrections' do
740
- expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"have", "type"=>"no_mistake"}, 2=>{"token"=>"three", "type"=>"no_mistake"}, 3=>{"token"=>"child", "type"=>"pluralization_mistake"}, 4=>{"token"=>"children", "type"=>"pluralization_correction"}, 5=>{"token"=>".", "type"=>"missing_punctuation_mistake"}})
876
+ expect(@cc.correct).to eq({0=>{"token"=>"I", "type"=>"no_mistake"}, 1=>{"token"=>"have", "type"=>"no_mistake"}, 2=>{"token"=>"three", "type"=>"no_mistake"}, 3=>{"token"=>"child", "type"=>"pluralization_mistake"}, 4=>{"token"=>"children", "type"=>"pluralization_correction"}, 5=>{"token"=>".", "type"=>"missing_punctuation_correction"}})
741
877
  end
742
878
 
743
- # it 'Counts the number of mistakes' do
744
- # expect(@cc.number_of_mistakes).to eq([])
745
- # end
879
+ it 'Reports the mistakes' do
880
+ expect(@cc.mistakes).to eq({0=>{"position"=>3, "error_type"=>"pluralization", "mistake"=>"child", "correction"=>"children"}, 1=>{"position"=>5, "error_type"=>"punctuation", "mistake"=>""}})
881
+ end
746
882
 
747
- # it 'Reports the mistakes by mistake type' do
748
- # expect(@cc.mistake_report).to eq([])
749
- # end
883
+ it 'Counts the number of mistakes' do
884
+ expect(@cc.number_of_mistakes).to eq(2)
885
+ end
886
+
887
+ it 'Reports the mistakes by mistake type' do
888
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>1, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>1, "possessive"=>0, "stylistic_choice"=>0})
889
+ end
750
890
  end
751
891
 
752
892
  context "example correction #038" do
@@ -757,16 +897,20 @@ RSpec.describe ChatCorrect::Correct do
757
897
  end
758
898
 
759
899
  it 'Annotates the corrections' do
760
- expect(@cc.correct).to eq({0=>{"token"=>"is", "type"=>"capitalization_mistake"}, 1=>{"token"=>"Is", "type"=>"capitalization_correction"}, 2=>{"token"=>"the", "type"=>"no_mistake"}, 3=>{"token"=>"bag", "type"=>"no_mistake"}, 4=>{"token"=>"your", "type"=>"pluralization_mistake"}, 5=>{"token"=>"yours", "type"=>"pluralization_correction"}, 6=>{"token"=>"?", "type"=>"missing_punctuation_mistake"}})
900
+ expect(@cc.correct).to eq({0=>{"token"=>"is", "type"=>"capitalization_mistake"}, 1=>{"token"=>"Is", "type"=>"capitalization_correction"}, 2=>{"token"=>"the", "type"=>"no_mistake"}, 3=>{"token"=>"bag", "type"=>"no_mistake"}, 4=>{"token"=>"your", "type"=>"pluralization_mistake"}, 5=>{"token"=>"yours", "type"=>"pluralization_correction"}, 6=>{"token"=>"?", "type"=>"missing_punctuation_correction"}})
761
901
  end
762
902
 
763
- # it 'Counts the number of mistakes' do
764
- # expect(@cc.number_of_mistakes).to eq([])
765
- # end
903
+ it 'Reports the mistakes' do
904
+ expect(@cc.mistakes).to eq({0=>{"position"=>0, "error_type"=>"capitalization", "mistake"=>"is", "correction"=>"Is"}, 1=>{"position"=>4, "error_type"=>"pluralization", "mistake"=>"your", "correction"=>"yours"}, 2=>{"position"=>6, "error_type"=>"punctuation", "mistake"=>""}})
905
+ end
766
906
 
767
- # it 'Reports the mistakes by mistake type' do
768
- # expect(@cc.mistake_report).to eq([])
769
- # end
907
+ it 'Counts the number of mistakes' do
908
+ expect(@cc.number_of_mistakes).to eq(3)
909
+ end
910
+
911
+ it 'Reports the mistakes by mistake type' do
912
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>1, "word_order"=>0, "capitalization"=>1, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>1, "possessive"=>0, "stylistic_choice"=>0})
913
+ end
770
914
  end
771
915
 
772
916
  context "example correction #039" do
@@ -777,16 +921,20 @@ RSpec.describe ChatCorrect::Correct do
777
921
  end
778
922
 
779
923
  it 'Annotates the corrections' do
780
- expect(@cc.correct).to eq({0=>{"token"=>"Is", "type"=>"no_mistake"}, 1=>{"token"=>"the", "type"=>"word_choice_mistake"}, 2=>{"token"=>"this", "type"=>"word_choice_correction"}, 3=>{"token"=>"your", "type"=>"word_order_mistake"}, 4=>{"token"=>"bag", "type"=>"word_order_mistake"}, 5=>{"token"=>"?", "type"=>"missing_punctuation_mistake"}})
924
+ expect(@cc.correct).to eq({0=>{"token"=>"Is", "type"=>"no_mistake"}, 1=>{"token"=>"the", "type"=>"word_choice_mistake"}, 2=>{"token"=>"this", "type"=>"word_choice_correction"}, 3=>{"token"=>"your", "type"=>"word_order_mistake"}, 4=>{"token"=>"bag", "type"=>"word_order_mistake"}, 5=>{"token"=>"?", "type"=>"missing_punctuation_correction"}})
781
925
  end
782
926
 
783
- # it 'Counts the number of mistakes' do
784
- # expect(@cc.number_of_mistakes).to eq([])
785
- # end
927
+ it 'Reports the mistakes' do
928
+ expect(@cc.mistakes).to eq({0=>{"position"=>1, "error_type"=>"word_choice", "mistake"=>"the", "correction"=>"this"}, 1=>{"position"=>3, "error_type"=>"word_order", "mistake"=>"bag", "correction"=>"N/A"}, 2=>{"position"=>4, "error_type"=>"word_order", "mistake"=>"your", "correction"=>"N/A"}, 3=>{"position"=>5, "error_type"=>"punctuation", "mistake"=>""}})
929
+ end
786
930
 
787
- # it 'Reports the mistakes by mistake type' do
788
- # expect(@cc.mistake_report).to eq([])
789
- # end
931
+ it 'Counts the number of mistakes' do
932
+ expect(@cc.number_of_mistakes).to eq(4)
933
+ end
934
+
935
+ it 'Reports the mistakes by mistake type' do
936
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>1, "word_order"=>2, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>1, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
937
+ end
790
938
  end
791
939
 
792
940
  context "example correction #040" do
@@ -800,13 +948,13 @@ RSpec.describe ChatCorrect::Correct do
800
948
  expect(@cc.correct).to eq({0=>{"token"=>"He", "type"=>"no_mistake"}, 1=>{"token"=>"doesnt", "type"=>"punctuation_mistake"}, 2=>{"token"=>"doesn't", "type"=>"punctuation_correction"}, 3=>{"token"=>"wear", "type"=>"no_mistake"}, 4=>{"token"=>"a", "type"=>"no_mistake"}, 5=>{"token"=>"tie", "type"=>"no_mistake"}, 6=>{"token"=>".", "type"=>"no_mistake"}})
801
949
  end
802
950
 
803
- # it 'Counts the number of mistakes' do
804
- # expect(@cc.number_of_mistakes).to eq([])
805
- # end
951
+ it 'Counts the number of mistakes' do
952
+ expect(@cc.number_of_mistakes).to eq(1)
953
+ end
806
954
 
807
- # it 'Reports the mistakes by mistake type' do
808
- # expect(@cc.mistake_report).to eq([])
809
- # end
955
+ it 'Reports the mistakes by mistake type' do
956
+ expect(@cc.mistake_report).to eq({"missing_word"=>0, "unnecessary_word"=>0, "spelling"=>0, "verb"=>0, "punctuation"=>1, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>0, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
957
+ end
810
958
  end
811
959
 
812
960
  context "example correction #041" do
@@ -820,13 +968,13 @@ RSpec.describe ChatCorrect::Correct do
820
968
  expect(@cc.correct).to eq({0=>{"token"=>"Rather", "type"=>"word_choice_mistake"}, 1=>{"token"=>"More", "type"=>"word_choice_correction"}, 2=>{"token"=>"than", "type"=>"no_mistake"}, 3=>{"token"=>"the", "type"=>"unnecessary_word_mistake"}, 4=>{"token"=>"TV", "type"=>"no_mistake"}, 5=>{"token"=>",", "type"=>"no_mistake"}, 6=>{"token"=>"I", "type"=>"no_mistake"}, 7=>{"token"=>"feel", "type"=>"no_mistake"}, 8=>{"token"=>"the", "type"=>"no_mistake"}, 9=>{"token"=>"appearance", "type"=>"no_mistake"}, 10=>{"token"=>"of", "type"=>"no_mistake"}, 11=>{"token"=>"internet", "type"=>"no_mistake"}, 12=>{"token"=>"to", "type"=>"no_mistake"}, 13=>{"token"=>"be", "type"=>"no_mistake"}, 14=>{"token"=>"more", "type"=>"no_mistake"}, 15=>{"token"=>"likely", "type"=>"missing_word_mistake"}, 16=>{"token"=>"to", "type"=>"missing_word_mistake"}, 17=>{"token"=>"interrupt", "type"=>"no_mistake"}, 18=>{"token"=>"our", "type"=>"no_mistake"}, 19=>{"token"=>"communication", "type"=>"no_mistake"}, 20=>{"token"=>".", "type"=>"no_mistake"}})
821
969
  end
822
970
 
823
- # it 'Counts the number of mistakes' do
824
- # expect(@cc.number_of_mistakes).to eq([])
825
- # end
971
+ it 'Counts the number of mistakes' do
972
+ expect(@cc.number_of_mistakes).to eq(4)
973
+ end
826
974
 
827
- # it 'Reports the mistakes by mistake type' do
828
- # expect(@cc.mistake_report).to eq([])
829
- # end
975
+ it 'Reports the mistakes by mistake type' do
976
+ expect(@cc.mistake_report).to eq({"missing_word"=>2, "unnecessary_word"=>1, "spelling"=>0, "verb"=>0, "punctuation"=>0, "word_order"=>0, "capitalization"=>0, "duplicate_word"=>0, "word_choice"=>1, "pluralization"=>0, "possessive"=>0, "stylistic_choice"=>0})
977
+ end
830
978
  end
831
979
 
832
980
  # context "example correction #042" do
@@ -959,7 +1107,7 @@ RSpec.describe ChatCorrect::Correct do
959
1107
  end
960
1108
 
961
1109
  it 'Annotates the corrections' do
962
- expect(@cc.correct).to eq({0=>{"token"=>"Actually", "type"=>"no_mistake"}, 1=>{"token"=>"when", "type"=>"unnecessary_word_mistake"}, 2=>{"token"=>",", "type"=>"missing_punctuation_mistake"}, 3=>{"token"=>"I", "type"=>"no_mistake"}, 4=>{"token"=>"attended", "type"=>"no_mistake"}, 5=>{"token"=>"the", "type"=>"no_mistake"}, 6=>{"token"=>"international", "type"=>"no_mistake"}, 7=>{"token"=>"meeting", "type"=>"no_mistake"}, 8=>{"token"=>",", "type"=>"punctuation_mistake"}, 9=>{"token"=>"or", "type"=>"unnecessary_word_mistake"}, 10=>{"token"=>"for", "type"=>"missing_word_mistake"}, 11=>{"token"=>"the", "type"=>"missing_word_mistake"}, 12=>{"token"=>"American", "type"=>"no_mistake"}, 13=>{"token"=>"society", "type"=>"capitalization_mistake"}, 14=>{"token"=>"Society", "type"=>"capitalization_correction"}, 15=>{"token"=>"for", "type"=>"no_mistake"}, 16=>{"token"=>"surgery", "type"=>"no_mistake"}, 17=>{"token"=>"of", "type"=>"no_mistake"}, 18=>{"token"=>"hand", "type"=>"no_mistake"}, 19=>{"token"=>",", "type"=>"punctuation_mistake"}, 20=>{"token"=>"at", "type"=>"unnecessary_word_mistake"}, 21=>{"token"=>"while", "type"=>"missing_word_mistake"}, 22=>{"token"=>"I", "type"=>"missing_word_mistake"}, 23=>{"token"=>"was", "type"=>"missing_word_mistake"}, 24=>{"token"=>"on", "type"=>"missing_word_mistake"}, 25=>{"token"=>"the", "type"=>"no_mistake"}, 26=>{"token"=>"trip", "type"=>"no_mistake"}, 27=>{"token"=>".", "type"=>"no_mistake"}})
1110
+ expect(@cc.correct).to eq({0=>{"token"=>"Actually", "type"=>"no_mistake"}, 1=>{"token"=>"when", "type"=>"unnecessary_word_mistake"}, 2=>{"token"=>",", "type"=>"missing_punctuation_correction"}, 3=>{"token"=>"I", "type"=>"no_mistake"}, 4=>{"token"=>"attended", "type"=>"no_mistake"}, 5=>{"token"=>"the", "type"=>"no_mistake"}, 6=>{"token"=>"international", "type"=>"no_mistake"}, 7=>{"token"=>"meeting", "type"=>"no_mistake"}, 8=>{"token"=>",", "type"=>"punctuation_mistake"}, 9=>{"token"=>"or", "type"=>"unnecessary_word_mistake"}, 10=>{"token"=>"for", "type"=>"missing_word_mistake"}, 11=>{"token"=>"the", "type"=>"missing_word_mistake"}, 12=>{"token"=>"American", "type"=>"no_mistake"}, 13=>{"token"=>"society", "type"=>"capitalization_mistake"}, 14=>{"token"=>"Society", "type"=>"capitalization_correction"}, 15=>{"token"=>"for", "type"=>"no_mistake"}, 16=>{"token"=>"surgery", "type"=>"no_mistake"}, 17=>{"token"=>"of", "type"=>"no_mistake"}, 18=>{"token"=>"hand", "type"=>"no_mistake"}, 19=>{"token"=>",", "type"=>"punctuation_mistake"}, 20=>{"token"=>"at", "type"=>"unnecessary_word_mistake"}, 21=>{"token"=>"while", "type"=>"missing_word_mistake"}, 22=>{"token"=>"I", "type"=>"missing_word_mistake"}, 23=>{"token"=>"was", "type"=>"missing_word_mistake"}, 24=>{"token"=>"on", "type"=>"missing_word_mistake"}, 25=>{"token"=>"the", "type"=>"no_mistake"}, 26=>{"token"=>"trip", "type"=>"no_mistake"}, 27=>{"token"=>".", "type"=>"no_mistake"}})
963
1111
  end
964
1112
 
965
1113
  # it 'Counts the number of mistakes' do
@@ -1596,4 +1744,160 @@ RSpec.describe ChatCorrect::Correct do
1596
1744
  # expect(@cc.mistake_report).to eq([])
1597
1745
  # end
1598
1746
  # end
1747
+
1748
+ context "example correction #079" do
1749
+ before do
1750
+ original_sentence = nil
1751
+ corrected_sentence = nil
1752
+ @cc = ChatCorrect::Correct.new(original_sentence: original_sentence, corrected_sentence: corrected_sentence)
1753
+ end
1754
+
1755
+ it 'Annotates the corrections' do
1756
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1757
+ end
1758
+
1759
+ it 'Reports the mistakes' do
1760
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1761
+ end
1762
+
1763
+ it 'Counts the number of mistakes' do
1764
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1765
+ end
1766
+
1767
+ it 'Reports the mistakes by mistake type' do
1768
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1769
+ end
1770
+ end
1771
+
1772
+ context "example correction #080" do
1773
+ before do
1774
+ original_sentence = nil
1775
+ corrected_sentence = 'Hello world'
1776
+ @cc = ChatCorrect::Correct.new(original_sentence: original_sentence, corrected_sentence: corrected_sentence)
1777
+ end
1778
+
1779
+ it 'Annotates the corrections' do
1780
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1781
+ end
1782
+
1783
+ it 'Reports the mistakes' do
1784
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1785
+ end
1786
+
1787
+ it 'Counts the number of mistakes' do
1788
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1789
+ end
1790
+
1791
+ it 'Reports the mistakes by mistake type' do
1792
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1793
+ end
1794
+ end
1795
+
1796
+ context "example correction #081" do
1797
+ before do
1798
+ original_sentence = 'Hello world'
1799
+ corrected_sentence = nil
1800
+ @cc = ChatCorrect::Correct.new(original_sentence: original_sentence, corrected_sentence: corrected_sentence)
1801
+ end
1802
+
1803
+ it 'Annotates the corrections' do
1804
+ expect { @cc.correct }.to raise_error('You must include a Corrected Sentence')
1805
+ end
1806
+
1807
+ it 'Reports the mistakes' do
1808
+ expect { @cc.correct }.to raise_error('You must include a Corrected Sentence')
1809
+ end
1810
+
1811
+ it 'Counts the number of mistakes' do
1812
+ expect { @cc.correct }.to raise_error('You must include a Corrected Sentence')
1813
+ end
1814
+
1815
+ it 'Reports the mistakes by mistake type' do
1816
+ expect { @cc.correct }.to raise_error('You must include a Corrected Sentence')
1817
+ end
1818
+ end
1819
+
1820
+ context "example correction #082" do
1821
+ before do
1822
+ original_sentence = ''
1823
+ corrected_sentence = ''
1824
+ @cc = ChatCorrect::Correct.new(original_sentence: original_sentence, corrected_sentence: corrected_sentence)
1825
+ end
1826
+
1827
+ it 'Annotates the corrections' do
1828
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1829
+ end
1830
+
1831
+ it 'Reports the mistakes' do
1832
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1833
+ end
1834
+
1835
+ it 'Counts the number of mistakes' do
1836
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1837
+ end
1838
+
1839
+ it 'Reports the mistakes by mistake type' do
1840
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1841
+ end
1842
+ end
1843
+
1844
+ context "example correction #083" do
1845
+ before do
1846
+ original_sentence = ''
1847
+ corrected_sentence = 'Hello world'
1848
+ @cc = ChatCorrect::Correct.new(original_sentence: original_sentence, corrected_sentence: corrected_sentence)
1849
+ end
1850
+
1851
+ it 'Annotates the corrections' do
1852
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1853
+ end
1854
+
1855
+ it 'Reports the mistakes' do
1856
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1857
+ end
1858
+
1859
+ it 'Counts the number of mistakes' do
1860
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1861
+ end
1862
+
1863
+ it 'Reports the mistakes by mistake type' do
1864
+ expect { @cc.correct }.to raise_error('You must include an Original Sentence')
1865
+ end
1866
+ end
1867
+
1868
+ context "example correction #084" do
1869
+ before do
1870
+ original_sentence = 'Hello world'
1871
+ corrected_sentence = ''
1872
+ @cc = ChatCorrect::Correct.new(original_sentence: original_sentence, corrected_sentence: corrected_sentence)
1873
+ end
1874
+
1875
+ it 'Annotates the corrections' do
1876
+ expect { @cc.correct }.to raise_error('You must include a Corrected Sentence')
1877
+ end
1878
+
1879
+ it 'Reports the mistakes' do
1880
+ expect { @cc.correct }.to raise_error('You must include a Corrected Sentence')
1881
+ end
1882
+
1883
+ it 'Counts the number of mistakes' do
1884
+ expect { @cc.correct }.to raise_error('You must include a Corrected Sentence')
1885
+ end
1886
+
1887
+ it 'Reports the mistakes by mistake type' do
1888
+ expect { @cc.correct }.to raise_error('You must include a Corrected Sentence')
1889
+ end
1890
+ end
1891
+
1892
+ context "example correction #085" do
1893
+ before do
1894
+ original_sentence = 'heyz uz guz'
1895
+ corrected_sentence = 'Hey you guys!'
1896
+ @cc = ChatCorrect::Correct.new(original_sentence: original_sentence, corrected_sentence: corrected_sentence)
1897
+ end
1898
+
1899
+ it 'Annotates the corrections' do
1900
+ expect(@cc.correct).to eq({0=>{"token"=>"heyz", "type"=>"unnecessary_word_mistake"}, 1=>{"token"=>"uz", "type"=>"unnecessary_word_mistake"}, 2=>{"token"=>"Hey", "type"=>"missing_word_mistake"}, 3=>{"token"=>"you", "type"=>"missing_word_mistake"}, 4=>{"token"=>"guz", "type"=>"spelling_mistake"}, 5=>{"token"=>"guys", "type"=>"spelling_correction"}, 6=>{"token"=>"!", "type"=>"missing_punctuation_correction"}})
1901
+ end
1902
+ end
1599
1903
  end