rwordnet 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +3 -0
- data/examples/full_hypernym.rb +5 -5
- data/examples/morphy.rb +20 -0
- data/examples/synset_find.rb +8 -0
- data/lib/wordnet/db.rb +11 -0
- data/lib/wordnet/lemma.rb +23 -2
- data/lib/wordnet/pointer.rb +19 -1
- data/lib/wordnet/synset.rb +186 -7
- data/lib/wordnet/version.rb +1 -1
- data/morphy/exceptions/adj.exc +1490 -0
- data/morphy/exceptions/adv.exc +7 -0
- data/morphy/exceptions/noun.exc +2054 -0
- data/morphy/exceptions/verb.exc +2401 -0
- data/test/test_helper.rb +19 -0
- data/test/unit/lemma_test.rb +1 -1
- data/test/unit/synset_test.rb +37 -1
- metadata +10 -4
data/test/test_helper.rb
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
require "codeclimate-test-reporter"
|
2
|
+
CodeClimate::TestReporter.start
|
3
|
+
|
4
|
+
require 'simplecov'
|
5
|
+
module SimpleCov::Configuration
|
6
|
+
def clean_filters
|
7
|
+
@filters = []
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
SimpleCov.configure do
|
12
|
+
clean_filters
|
13
|
+
load_profile 'test_frameworks'
|
14
|
+
end
|
15
|
+
|
16
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
17
|
+
add_filter "/.rvm/"
|
18
|
+
end
|
19
|
+
|
1
20
|
require "bundler/setup"
|
2
21
|
require "maxitest/autorun"
|
3
22
|
|
data/test/unit/lemma_test.rb
CHANGED
data/test/unit/synset_test.rb
CHANGED
@@ -33,8 +33,44 @@ describe WordNet::Synset do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'test expanded hypernym tree' do
|
36
|
-
expanded = synsets[0].
|
36
|
+
expanded = synsets[0].expanded_first_hypernyms
|
37
37
|
assert_equal 8, expanded.size
|
38
38
|
assert_equal "entity", expanded[expanded.size-1].words[0]
|
39
39
|
end
|
40
|
+
|
41
|
+
it 'finds a correct antonym' do
|
42
|
+
to_fall = WordNet::Lemma.find("fall", :verb).synsets[1]
|
43
|
+
assert_includes to_fall.antonyms[0].words, "rise"
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'finds hypernyms and hyponyms' do
|
47
|
+
animal = WordNet::Lemma.find("animal", :noun).synsets[0]
|
48
|
+
assert_includes animal.hyponyms[0].words, "pest"
|
49
|
+
assert_includes animal.hypernyms[0].words, "organism"
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'lemmatises with morphy' do
|
53
|
+
assert_includes WordNet::Synset.morphy('animals', 'noun'), "animal"
|
54
|
+
assert_includes WordNet::Synset.morphy_all('animals'), "animal"
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'returns an empty list for unmorphiable words' do
|
58
|
+
assert_equal WordNet::Synset.morphy('not_a_word!#@', 'noun').size, 0
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'finds lemmatised synsets' do
|
62
|
+
take = WordNet::Synset.find_all('take').map { |x| x.words }.flatten
|
63
|
+
assert_includes take, "claim"
|
64
|
+
assert_includes take, "ingest"
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'finds expanded hypernyms' do
|
68
|
+
animal = WordNet::Lemma.find("animal", :noun).synsets[0]
|
69
|
+
assert_includes animal.expanded_hypernyms.map { |x| x.words }.flatten, "entity"
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'finds expanded hypernyms with the right depth' do
|
73
|
+
animal = WordNet::Lemma.find("animal", :noun).synsets[0]
|
74
|
+
assert_equal animal.expanded_hypernyms_depth[1], 6
|
75
|
+
end
|
40
76
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rwordnet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Fountain
|
@@ -10,10 +10,10 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description:
|
16
|
-
email:
|
16
|
+
email: trevor@texasexpat.net
|
17
17
|
executables: []
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
@@ -35,6 +35,8 @@ files:
|
|
35
35
|
- examples/benchmark.rb
|
36
36
|
- examples/dictionary.rb
|
37
37
|
- examples/full_hypernym.rb
|
38
|
+
- examples/morphy.rb
|
39
|
+
- examples/synset_find.rb
|
38
40
|
- lib/wordnet.rb
|
39
41
|
- lib/wordnet/db.rb
|
40
42
|
- lib/wordnet/lemma.rb
|
@@ -42,6 +44,10 @@ files:
|
|
42
44
|
- lib/wordnet/pointers.rb
|
43
45
|
- lib/wordnet/synset.rb
|
44
46
|
- lib/wordnet/version.rb
|
47
|
+
- morphy/exceptions/adj.exc
|
48
|
+
- morphy/exceptions/adv.exc
|
49
|
+
- morphy/exceptions/noun.exc
|
50
|
+
- morphy/exceptions/verb.exc
|
45
51
|
- test/test_helper.rb
|
46
52
|
- test/unit/db_test.rb
|
47
53
|
- test/unit/lemma_test.rb
|
@@ -67,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
73
|
version: '0'
|
68
74
|
requirements: []
|
69
75
|
rubyforge_project:
|
70
|
-
rubygems_version: 2.
|
76
|
+
rubygems_version: 2.4.7
|
71
77
|
signing_key:
|
72
78
|
specification_version: 4
|
73
79
|
summary: A pure Ruby interface to the WordNet database
|