merriam_webster_plus 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.byebug_history +256 -0
- data/.github/workflows/main.yml +21 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +10 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +68 -0
- data/LICENSE.txt +21 -0
- data/README.md +93 -0
- data/Rakefile +18 -0
- data/bin/console +15 -0
- data/bin/mwp +4 -0
- data/bin/setup +8 -0
- data/fixtures/.DS_Store +0 -0
- data/fixtures/vcr_cassettes/.DS_Store +0 -0
- data/fixtures/vcr_cassettes/empty_api_entries.yml +37 -0
- data/fixtures/vcr_cassettes/heteronym_entries.yml +277 -0
- data/fixtures/vcr_cassettes/invalid_api_entries.yml +41 -0
- data/fixtures/vcr_cassettes/invalid_dictionary_plus_lookup.yml +79 -0
- data/fixtures/vcr_cassettes/invalid_endpoint_api_entries.yml +132 -0
- data/fixtures/vcr_cassettes/main_entries_dictionary.yml +210 -0
- data/fixtures/vcr_cassettes/main_entries_thesaurus.yml +70 -0
- data/fixtures/vcr_cassettes/main_entry_dictionary.yml +210 -0
- data/fixtures/vcr_cassettes/main_entry_thesaurus.yml +70 -0
- data/fixtures/vcr_cassettes/non_heteronym_entries.yml +157 -0
- data/fixtures/vcr_cassettes/valid_api_entries.yml +210 -0
- data/fixtures/vcr_cassettes/valid_dictionary_plus_lookup.yml +277 -0
- data/fixtures/vcr_cassettes/word_medley_primary_entry_population.yml +1384 -0
- data/fixtures/vcr_cassettes/word_not_in_dictionary_primary_entry.yml +141 -0
- data/fixtures/vcr_cassettes/word_not_in_thesaurus_primary_entry.yml +144 -0
- data/lib/.DS_Store +0 -0
- data/lib/merriam_webster_plus/.DS_Store +0 -0
- data/lib/merriam_webster_plus/client.rb +88 -0
- data/lib/merriam_webster_plus/dictionary_entries.rb +41 -0
- data/lib/merriam_webster_plus/dictionary_entry.rb +124 -0
- data/lib/merriam_webster_plus/dictionary_plus.rb +46 -0
- data/lib/merriam_webster_plus/dictionary_sense.rb +57 -0
- data/lib/merriam_webster_plus/entry_audio_merger.rb +55 -0
- data/lib/merriam_webster_plus/populator.rb +31 -0
- data/lib/merriam_webster_plus/primary_entry_finder.rb +41 -0
- data/lib/merriam_webster_plus/thesaurus_entries.rb +13 -0
- data/lib/merriam_webster_plus/thesaurus_entry.rb +12 -0
- data/lib/merriam_webster_plus/thesaurus_sense.rb +47 -0
- data/lib/merriam_webster_plus/version.rb +5 -0
- data/lib/merriam_webster_plus.rb +9 -0
- data/merriam_webster_plus.gemspec +35 -0
- data/test_out.csv +11 -0
- metadata +219 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b130e379f89000dd9d5662da07eb5fbebbeb5cff8d5ed9fabd6c0a4acc1902d9
|
4
|
+
data.tar.gz: d3171904a84c767ec0a3bd34c19d1e2244e5d8411e12b64c85a59c64d4167bbf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6606bdad9e006a0dceb5da3989df75a96ec157fa574d2bc7e3976854b4f1ac3d93623828e0091aadf94f9a5609104c3a548d21c878086b54e442e901a55c9a20
|
7
|
+
data.tar.gz: fff5b65d8f9eae1eb4a1f6d7663790c3317f514b0e797eb68582e660b9160a83c224477fe37214b89ff4054060ce8a5e9858d00f0ab7d2f6122e277ee45e4140
|
data/.DS_Store
ADDED
Binary file
|
data/.byebug_history
ADDED
@@ -0,0 +1,256 @@
|
|
1
|
+
exit
|
2
|
+
@invalid_primary_entry
|
3
|
+
c
|
4
|
+
@invalid_entries
|
5
|
+
exit
|
6
|
+
@invalid_entries
|
7
|
+
exit
|
8
|
+
@invalid_entries
|
9
|
+
exit
|
10
|
+
csv[10]
|
11
|
+
csv[9]
|
12
|
+
csv[8]
|
13
|
+
csv[7]
|
14
|
+
csv[6]
|
15
|
+
exit
|
16
|
+
csv[5]
|
17
|
+
csv[4]
|
18
|
+
csv[3]
|
19
|
+
csv[2]
|
20
|
+
exit
|
21
|
+
csv2[1]
|
22
|
+
csv2[0]
|
23
|
+
csv2.each {|row| p row}
|
24
|
+
csv2 = CSV.open("test/csvs/test_out.csv").read
|
25
|
+
csv2
|
26
|
+
csv2.each {|row| p row}
|
27
|
+
csv2 = CSV.open("test/csvs/test_out.csv").read.size
|
28
|
+
csv2 = CSV.open("test/csvs/test_out.csv").read.class
|
29
|
+
csv2 = CSV.open("test/csvs/test_out.csv").read
|
30
|
+
csv.class
|
31
|
+
csv
|
32
|
+
IO.readlines(csv)
|
33
|
+
IO.readlines(csv)[3]
|
34
|
+
exit
|
35
|
+
csv.first
|
36
|
+
csv.last
|
37
|
+
csv[2]
|
38
|
+
csv.first
|
39
|
+
csv[1]
|
40
|
+
csv.[1]
|
41
|
+
csv.first
|
42
|
+
csv = CSV.open("fixtures/csvs/test_out_fixture.csv")
|
43
|
+
csv.each {|row| p row}
|
44
|
+
csv.first
|
45
|
+
csv[0]
|
46
|
+
csv.each {|row| p row}
|
47
|
+
csv.each do {|row| p row}
|
48
|
+
csv.class
|
49
|
+
csv = CSV.open("fixtures/csvs/test_out_fixture.csv")
|
50
|
+
CSV.open("fixtures/csvs/test_out_fixture.csv")
|
51
|
+
File.open("fixtures/csvs/test_out_fixture.csv") == File.open("test/csvs/test_out.csv")
|
52
|
+
File.open("fixtures/csvs/test_out_fixture.csv")
|
53
|
+
File.open("fixtures/csvs/test_out_fixturea.csv")
|
54
|
+
File.open("fixtures/csvs/test_out_fixture.csv")
|
55
|
+
File.open("test/csvs/test_out.csv")
|
56
|
+
File.open("csvs/test_out.csv")
|
57
|
+
File.open(csvs/test_out.csv)
|
58
|
+
@word_medley_primary_entry.class
|
59
|
+
@word_medley_primary_entry
|
60
|
+
pwd
|
61
|
+
exit
|
62
|
+
@word_medley_primary_entry
|
63
|
+
exit
|
64
|
+
@heteronym_merged_entries[1][:audio]
|
65
|
+
@heteronym_merged_entries[0][:audio]
|
66
|
+
@heteronym_merged_entries.size
|
67
|
+
heteronym_merged_entries.size
|
68
|
+
exit
|
69
|
+
@non_heteronym_merged_entries[1][:audio]
|
70
|
+
@non_heteronym_merged_entries[0][:audio]
|
71
|
+
@non_heteronym_merged_entries.size
|
72
|
+
exit
|
73
|
+
@thesaurus_plus_lookup.primary_entry
|
74
|
+
@thesaurus_plus_lookup
|
75
|
+
exit
|
76
|
+
@non_heteronym_merged_entries.size
|
77
|
+
@non_heteronym_merged_entries.first
|
78
|
+
@non_heteronym_merged_entries
|
79
|
+
c
|
80
|
+
@heteronym_merged_entries
|
81
|
+
exit
|
82
|
+
MerriamWebsterPlus::EntryAudioMerger.new(dst_entries: heteronym_dst_entries,
|
83
|
+
src_entries: heteronym_src_entries).
|
84
|
+
merged_entries
|
85
|
+
exit
|
86
|
+
MerriamWebsterPlus::EntryAudioMerger.new(dst_entries: non_heteronym_dst_entries,
|
87
|
+
src_entries: non_heteronym_src_entries).
|
88
|
+
merged_entries
|
89
|
+
MerriamWebsterPlus::EntryAudioMerger.new(dst_entries: non_heteronym_dst_entries,
|
90
|
+
src_entries: non_heteronym_src_entries).
|
91
|
+
merged_entries
|
92
|
+
end
|
93
|
+
MerriamWebsterPlus::DictionaryEntries.new(word: "beach").main_entries
|
94
|
+
MerriamWebsterPlus::ThesaurusEntries.new(word: "beach").main_entries
|
95
|
+
exit
|
96
|
+
MerriamWebsterPlus::DictionaryEntries.new(word: "beach").main_entries
|
97
|
+
MerriamWebsterPlus::ThesaurusEntries.new(word: "beach").main_entries
|
98
|
+
MerriamWebsterPlus::ThesaurusEntries.new(word: "lake").main_entries
|
99
|
+
MerriamWebsterPlus::ThesaurusEntries.new(word: "summery").main_entries
|
100
|
+
MerriamWebsterPlus::DictionaryEntries.new(word: "summery").main_entries
|
101
|
+
MerriamWebsterPlus::DictionaryEntries.new(word: "summer").main_entries
|
102
|
+
MerriamWebsterPlus::ThesaurusEntries.new(word: "summer").main_entries
|
103
|
+
MerriamWebsterPlus::DictionaryEntries.new(word: "affect").main_entries
|
104
|
+
MerriamWebsterPlus::ThesaurusEntries.new(word: "affect").main_entries
|
105
|
+
exit
|
106
|
+
@heteronym_merged_entries.last[:audio]
|
107
|
+
@heteronym_merged_entries.first[:audio]
|
108
|
+
@heteronym_dst_entries.last
|
109
|
+
@heteronym_dst_entries.first
|
110
|
+
exit
|
111
|
+
@heteronym_entries.last[:audio]
|
112
|
+
@heteronym_entries[1][:audio]
|
113
|
+
@heteronym_entries.first[:audio]
|
114
|
+
@heteronym_entries.first
|
115
|
+
@heteronym_entries.size
|
116
|
+
@heteronym_entries.szie
|
117
|
+
@heteronym_entries
|
118
|
+
c
|
119
|
+
exit
|
120
|
+
@valid_primary_entry
|
121
|
+
puts JSON.pretty_generate(@valid_primary_entry) == @valid_primary_entry
|
122
|
+
puts JSON.pretty_generate(@valid_primary_entry)
|
123
|
+
@valid_primary_entry
|
124
|
+
@valid_entry
|
125
|
+
@valid_entries
|
126
|
+
c
|
127
|
+
exit
|
128
|
+
@valid_entries
|
129
|
+
exit
|
130
|
+
@valid_primary_sense[:antonyms_and_near_antonyms]
|
131
|
+
@valid_primary_sense[:antonyms]
|
132
|
+
@valid_primary_sense[:near_antonyms]
|
133
|
+
@valid_primary_sense[:synonymous_phrases]
|
134
|
+
@valid_primary_sense[:related_words]
|
135
|
+
@valid_primary_sense[:synonyms_and_near_synonyms]
|
136
|
+
@valid_primary_sense[:synonyms]
|
137
|
+
@valid_primary_sense[:definition]
|
138
|
+
exit
|
139
|
+
@valid_primary_sense[:example]
|
140
|
+
c
|
141
|
+
exit
|
142
|
+
sense_group
|
143
|
+
short_definition
|
144
|
+
exit
|
145
|
+
@valid_main_entry[:senses].first
|
146
|
+
@valid_main_entry[:senses]
|
147
|
+
exit
|
148
|
+
@valid_main_entry[:senses]
|
149
|
+
c
|
150
|
+
continuec
|
151
|
+
continue
|
152
|
+
c
|
153
|
+
continue
|
154
|
+
sense_sequence.size
|
155
|
+
sense_sequence
|
156
|
+
short_definition
|
157
|
+
continue
|
158
|
+
short_definition
|
159
|
+
exit
|
160
|
+
short_definition
|
161
|
+
sense_sequence.first
|
162
|
+
sense_sequence.first.size
|
163
|
+
sense_sequence.size
|
164
|
+
sense_sequence.szie
|
165
|
+
sense_sequence
|
166
|
+
exit
|
167
|
+
sense_sequence.each { |sense| puts sense.to_yaml }
|
168
|
+
sense_sequence.size
|
169
|
+
continue
|
170
|
+
sense_sequence.each { |sense| puts sense.to_yaml }
|
171
|
+
short_definition
|
172
|
+
sense_sequence.first[0]
|
173
|
+
sense_sequence.first[1]
|
174
|
+
sense_sequence.first
|
175
|
+
sense_sequence.first.first
|
176
|
+
sense_sequence.first
|
177
|
+
sense_sequence.first.first
|
178
|
+
sense_sequence.first.first.first
|
179
|
+
sense_sequence.first.first
|
180
|
+
sense_sequence.first
|
181
|
+
sense_sequence.first.size
|
182
|
+
sense_sequence.first
|
183
|
+
sense_sequence
|
184
|
+
exit
|
185
|
+
sense_sequence
|
186
|
+
sense_sequence.size
|
187
|
+
continue
|
188
|
+
sense_sequence.size
|
189
|
+
continue
|
190
|
+
sense_sequence.size
|
191
|
+
continue
|
192
|
+
sense_sequence.size
|
193
|
+
sense_sequence
|
194
|
+
sense_sequence.size
|
195
|
+
sense_sequence.each_with_index
|
196
|
+
continue
|
197
|
+
sense_sequence
|
198
|
+
sense_sequence[1]
|
199
|
+
sense_sequence.first
|
200
|
+
sense_sequence
|
201
|
+
exit
|
202
|
+
senses
|
203
|
+
sense_group
|
204
|
+
next
|
205
|
+
short_definition
|
206
|
+
sense_sequence.each { |sense| puts sense.to_yaml }
|
207
|
+
sense_sequence.each { |sense| p sense }
|
208
|
+
sense_sequence
|
209
|
+
exit
|
210
|
+
select_verbal_illustration_section(defining_text_snote_section)
|
211
|
+
defining_text_snote_section = defining_text_section&.select {|section| section[0]=="snote" }&.dig(0,1)
|
212
|
+
defining_text_snote_section = defining_text_section&.select {|section| section[0]=="snote" }&.dig(0)
|
213
|
+
defining_text_snote_section = defining_text_section&.select {|section| section[0]=="snote" }&.dig(0,1)
|
214
|
+
defining_text_snote_section = defining_text_section&.select {|section| section[0]=="snote" }&.dig(0,1,0)
|
215
|
+
defining_text_section&.select {|section| section[0]=="snote" }&.dig(0,1,0)
|
216
|
+
puts defining_text_section.to_yaml
|
217
|
+
defining_text_section
|
218
|
+
select_verbal_illustration_section(defining_text_section_usage_notes)
|
219
|
+
select_verbal_illustration_section(defining_text_section)
|
220
|
+
c
|
221
|
+
select_verbal_illustration_section(defining_text_section_usage_notes)
|
222
|
+
select_verbal_illustration_section(defining_text_section)
|
223
|
+
exit
|
224
|
+
defining_text_section&.select {|section| section[0]=="vis" }&.last ||
|
225
|
+
defining_text_section_usage_notes&.select {|section| section[0]=="vis" }&.last
|
226
|
+
defining_text_section&.select {|section| section[0]=="vis" }&.last
|
227
|
+
defining_text_section_usage_notesdefining_text_section&.select {|section| section[0]=="vis" }&.last
|
228
|
+
defining_text_section_usage_notes&.dig(1, 0, :t)&.gsub(/\{.*?\}/,'')&.strip
|
229
|
+
verbal_illustration_section&.dig(1, 0, :t)&.gsub(/\{.*?\}/,'')&.strip ||
|
230
|
+
defining_text_section_usage_notes&.dig(1, 0, :t)&.gsub(/\{.*?\}/,'')&.strip
|
231
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.dig(0,1,0)
|
232
|
+
defining_text_section&.select {|section| section[0]=="vis" }&.last
|
233
|
+
verbal_illustration_section
|
234
|
+
vis&.dig(1, 0, :t)&.gsub(/\{.*?\}/,'')&.strip
|
235
|
+
vis = defining_text_section_usage_notes&.select {|section| section[0]=="vis" }&.last
|
236
|
+
defining_text_section_usage_notes&.select {|section| section[0]=="vis" }&.last
|
237
|
+
defining_text_section
|
238
|
+
defining_text_section_usage_notes
|
239
|
+
defining_text_section_usage_notes&.select {|section| section[0]=="vis" }&.last
|
240
|
+
defining_text_section_usage_notes = defining_text_section&.select {|section| section[0]=="uns" }&.dig(0,1,0)
|
241
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.dig(0,1,0)
|
242
|
+
v
|
243
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.dig(0,1,0,)
|
244
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.dig(0,1,0,0)
|
245
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.dig(0,1,0)
|
246
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.dig(0,1)
|
247
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.dig(0,0)
|
248
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.dig(0)
|
249
|
+
defining_text_section&.select {|section| section[0]=="uns" }
|
250
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.dig(0,0,0)
|
251
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.dig(0,0,0).size
|
252
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.last&.last&.last.size
|
253
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.last&.last&.last
|
254
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.last&.last.size
|
255
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.last&.last
|
256
|
+
defining_text_section&.select {|section| section[0]=="uns" }&.last.size
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push,pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
env:
|
9
|
+
COLLEGIATE_DICTIONARY_API_KEY: ${{ secrets.COLLEGIATE_DICTIONARY_API_KEY }}
|
10
|
+
COLLEGIATE_THESAURUS_API_KEY: ${{ secrets.COLLEGIATE_THESAURUS_API_KEY }}
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.0.0
|
17
|
+
- name: Run the default task
|
18
|
+
run: |
|
19
|
+
gem install bundler -v 2.2.3
|
20
|
+
bundle install
|
21
|
+
bundle exec rake
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
merriam_webster_plus (0.1.0)
|
5
|
+
bundler (~> 2.3)
|
6
|
+
httparty
|
7
|
+
json
|
8
|
+
minitest
|
9
|
+
minitest-stub-const
|
10
|
+
rake
|
11
|
+
rubocop
|
12
|
+
vcr
|
13
|
+
webmock
|
14
|
+
|
15
|
+
GEM
|
16
|
+
remote: https://rubygems.org/
|
17
|
+
specs:
|
18
|
+
addressable (2.8.0)
|
19
|
+
public_suffix (>= 2.0.2, < 5.0)
|
20
|
+
ast (2.4.2)
|
21
|
+
crack (0.4.5)
|
22
|
+
rexml
|
23
|
+
hashdiff (1.0.1)
|
24
|
+
httparty (0.20.0)
|
25
|
+
mime-types (~> 3.0)
|
26
|
+
multi_xml (>= 0.5.2)
|
27
|
+
json (2.6.2)
|
28
|
+
mime-types (3.4.1)
|
29
|
+
mime-types-data (~> 3.2015)
|
30
|
+
mime-types-data (3.2022.0105)
|
31
|
+
minitest (5.16.1)
|
32
|
+
minitest-stub-const (0.6)
|
33
|
+
multi_xml (0.6.0)
|
34
|
+
parallel (1.22.1)
|
35
|
+
parser (3.1.2.0)
|
36
|
+
ast (~> 2.4.1)
|
37
|
+
public_suffix (4.0.7)
|
38
|
+
rainbow (3.1.1)
|
39
|
+
rake (13.0.6)
|
40
|
+
regexp_parser (2.5.0)
|
41
|
+
rexml (3.2.5)
|
42
|
+
rubocop (1.30.1)
|
43
|
+
parallel (~> 1.10)
|
44
|
+
parser (>= 3.1.0.0)
|
45
|
+
rainbow (>= 2.2.2, < 4.0)
|
46
|
+
regexp_parser (>= 1.8, < 3.0)
|
47
|
+
rexml (>= 3.2.5, < 4.0)
|
48
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
49
|
+
ruby-progressbar (~> 1.7)
|
50
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
51
|
+
rubocop-ast (1.18.0)
|
52
|
+
parser (>= 3.1.1.0)
|
53
|
+
ruby-progressbar (1.11.0)
|
54
|
+
unicode-display_width (2.1.0)
|
55
|
+
vcr (6.1.0)
|
56
|
+
webmock (3.14.0)
|
57
|
+
addressable (>= 2.8.0)
|
58
|
+
crack (>= 0.3.2)
|
59
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
60
|
+
|
61
|
+
PLATFORMS
|
62
|
+
x86_64-darwin-20
|
63
|
+
|
64
|
+
DEPENDENCIES
|
65
|
+
merriam_webster_plus!
|
66
|
+
|
67
|
+
BUNDLED WITH
|
68
|
+
2.3.16
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
## Merriam-Webster Plus
|
2
|
+
|
3
|
+
Easily get word definitions, synonyms/antonyms, usage examples, audio pronunciations, and more.
|
4
|
+
|
5
|
+
Optimizes core Merriam-Webster APIs to create a singular lexical resource with maximal parts-of-dictionary-entry coverage.
|
6
|
+
|
7
|
+
E.g. running 800 words from an official spelling bee list shows the following primary-entry coverage for Merriam-Webster Plus vs. its component sources:
|
8
|
+
|
9
|
+
| Lexical Resource | Part of Speech | Definition | Example Sentence | Audio |
|
10
|
+
| ----------------------------------------- |:--------------:| ----------:| ----------------:| -----:|
|
11
|
+
| Merriam-Webster Plus | 99% | 99% | 87% | 92% |
|
12
|
+
| Merriam-Webster's Collegiate Dictionary | 94% | 94% | 59% | 89% |
|
13
|
+
| Merriam-Webster's Collegiate Thesaurus | 87% | 87% | 82% | 0% |
|
14
|
+
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
Set environment variables for `COLLEGIATE_DICTIONARY_API_KEY` and `COLLEGIATE_THESAURUS_API_KEY` with eponymous keys from https://dictionaryapi.com/register/index.
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
>> require "merriam_webster_plus"
|
22
|
+
>> lookup = MerriamWebsterPlus::DictionaryPlus.new(word: "run")
|
23
|
+
```
|
24
|
+
```
|
25
|
+
>> puts lookup.primary_entry.to_yaml
|
26
|
+
---
|
27
|
+
:word: run
|
28
|
+
:class: verb
|
29
|
+
:definition: to go at a pace faster than a walk
|
30
|
+
:example: we ran all the way to the bus stop, but still missed the bus
|
31
|
+
:audio: https://media.merriam-webster.com/audio/prons/en/us/mp3/r/run00001.mp3
|
32
|
+
```
|
33
|
+
|
34
|
+
```
|
35
|
+
>> puts lookup.entries.to_yaml
|
36
|
+
---
|
37
|
+
- :word: run
|
38
|
+
:class: verb
|
39
|
+
:audio: https://media.merriam-webster.com/audio/prons/en/us/mp3/r/run00001.mp3
|
40
|
+
:senses:
|
41
|
+
- - 1
|
42
|
+
- :definition: to go at a pace faster than a walk
|
43
|
+
:synonyms: dash, gallop, jog, scamper, sprint, trip, trot
|
44
|
+
:related_words: bound, canter, leap, lope, shag, skip, spring
|
45
|
+
:near_antonyms: amble, saunter, shamble, shuffle, stroll
|
46
|
+
:example: we ran all the way to the bus stop, but still missed the bus
|
47
|
+
- - 2
|
48
|
+
- :definition: to hasten away from something dangerous or frightening
|
49
|
+
:synonyms: bolt, break, bug out, flee, fly, hightail (it), retreat, run away,
|
50
|
+
run off, skedaddle
|
51
|
+
:related_words: abscond, clear out, decamp, elope, escape, get (away), get out,
|
52
|
+
lam, light out, make off, mizzle, scarper, scat, scram, skip (out), skirr
|
53
|
+
:synonymous_phrases: beat a retreat, beat it, make tracks, turn tail
|
54
|
+
:near_antonyms: beard, brave, confront, dare, defy, face
|
55
|
+
:example: rather than run from a black bear, it's better to hold your ground
|
56
|
+
and make lots of noise
|
57
|
+
- - 3
|
58
|
+
- :definition: to be positioned along a certain course or in a certain direction
|
59
|
+
:synonyms: bear, extend, go, head, lead, lie
|
60
|
+
:related_words: cross, cut, pass
|
61
|
+
:example: the road runs along the river for a while
|
62
|
+
- :word: run
|
63
|
+
:class: noun
|
64
|
+
:audio: https://media.merriam-webster.com/audio/prons/en/us/mp3/r/run00001.mp3
|
65
|
+
:senses:
|
66
|
+
- - 1
|
67
|
+
- :definition: a prevailing or general movement or inclination
|
68
|
+
:synonyms: current, direction, drift, leaning, tendency, tide, trend, wind
|
69
|
+
:related_words: curve, downside, shift, swing, turn, turnabout, upside
|
70
|
+
:example: the company's stock has remained consistent with the overall run of
|
71
|
+
the market
|
72
|
+
- - 2
|
73
|
+
- :definition: a natural body of running water smaller than a river
|
74
|
+
:synonyms: beck, bourn, brook, brooklet, burn, creek, gill, rill, rivulet, runlet,
|
75
|
+
runnel, streamlet
|
76
|
+
:related_words: arroyo, billabong, fresh, freshet, runoff
|
77
|
+
:example: a run full of catfish
|
78
|
+
- - 3
|
79
|
+
- :definition: the period during which something exists, lasts, or is in progress
|
80
|
+
:synonyms: continuance, date, duration, life, life span, lifetime, standing,
|
81
|
+
time
|
82
|
+
:related_words: spell, stretch
|
83
|
+
:example: the actor has been assigned the part for the run of the show
|
84
|
+
|
85
|
+
```
|
86
|
+
|
87
|
+
## Contributing
|
88
|
+
|
89
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/CRiSToBaLZ/merriam_webster_plus.
|
90
|
+
|
91
|
+
## License
|
92
|
+
|
93
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "rubocop/rake_task"
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new(:rubocop) do |t|
|
15
|
+
t.options = ["--fail-level", "E"]
|
16
|
+
end
|
17
|
+
|
18
|
+
task default: %i[test rubocop]
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "merriam_webster_plus"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/mwp
ADDED
data/bin/setup
ADDED
data/fixtures/.DS_Store
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.dictionaryapi.com/api/v3/references/collegiate/json/?key=<COLLEGIATE_DICTIONARY_API_KEY>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Tue, 21 Jun 2022 23:24:59 GMT
|
23
|
+
Content-Type:
|
24
|
+
- text/html; charset=UTF-8
|
25
|
+
Content-Length:
|
26
|
+
- '17'
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
Server:
|
30
|
+
- Apache
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- "*"
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: Word is required.
|
36
|
+
recorded_at: Tue, 21 Jun 2022 23:24:59 GMT
|
37
|
+
recorded_with: VCR 6.1.0
|