textrazor 0.0.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/README.md +26 -2
- data/Rakefile +10 -2
- data/lib/textrazor.rb +5 -0
- data/lib/textrazor/client.rb +38 -5
- data/lib/textrazor/configuration.rb +1 -1
- data/lib/textrazor/entailment.rb +24 -0
- data/lib/textrazor/property.rb +22 -0
- data/lib/textrazor/relation.rb +25 -0
- data/lib/textrazor/relation_param.rb +18 -0
- data/lib/textrazor/request.rb +6 -2
- data/lib/textrazor/response.rb +110 -34
- data/lib/textrazor/sentence.rb +24 -0
- data/lib/textrazor/topic.rb +8 -6
- data/lib/textrazor/util.rb +1 -1
- data/lib/textrazor/version.rb +1 -1
- data/lib/textrazor/word.rb +1 -1
- data/spec/functional/service_spec.rb +29 -0
- data/spec/lib/textrazor/client_spec.rb +113 -65
- data/spec/lib/textrazor/entailment_spec.rb +36 -0
- data/spec/lib/textrazor/entity_spec.rb +50 -26
- data/spec/lib/textrazor/phrase_spec.rb +8 -4
- data/spec/lib/textrazor/property_spec.rb +30 -0
- data/spec/lib/textrazor/relation_param_spec.rb +29 -0
- data/spec/lib/textrazor/relation_spec.rb +37 -0
- data/spec/lib/textrazor/request_spec.rb +7 -4
- data/spec/lib/textrazor/response_spec.rb +604 -49
- data/spec/lib/textrazor/sentence_spec.rb +41 -0
- data/spec/lib/textrazor/topic_spec.rb +12 -5
- data/textrazor.gemspec +1 -0
- metadata +35 -2
@@ -0,0 +1,41 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module TextRazor
|
4
|
+
|
5
|
+
describe Sentence do
|
6
|
+
|
7
|
+
context "#create_from_hash" do
|
8
|
+
let(:sentence_hash) do
|
9
|
+
{
|
10
|
+
:position=>0,
|
11
|
+
:words=>
|
12
|
+
[{
|
13
|
+
:position=>0,
|
14
|
+
:startingPos=>0,
|
15
|
+
:endingPos=>8,
|
16
|
+
:stem=>"barclay",
|
17
|
+
:lemma=>"barclay",
|
18
|
+
:token=>"Barclays",
|
19
|
+
:partOfSpeech=>"NNP",
|
20
|
+
:parentPosition=>1,
|
21
|
+
:relationToParent=>"nsubj"
|
22
|
+
}]
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
let(:sentence) do
|
27
|
+
Sentence.create_from_hash(sentence_hash)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should create a new instance" do
|
31
|
+
expect(sentence.position).to eq(0)
|
32
|
+
expect(sentence.number_of_words).to eq(1)
|
33
|
+
expect(sentence.words.first).to be_instance_of(Word)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
@@ -5,13 +5,20 @@ module TextRazor
|
|
5
5
|
describe Topic do
|
6
6
|
|
7
7
|
context "#create_from_hash" do
|
8
|
+
let(:topic_hash) do
|
9
|
+
{
|
10
|
+
id: 1,
|
11
|
+
label: "Sports",
|
12
|
+
wikiLink: "link_to_wiki",
|
13
|
+
score: 1.03589
|
14
|
+
}
|
15
|
+
end
|
8
16
|
|
9
|
-
|
10
|
-
topic_hash
|
11
|
-
|
12
|
-
|
13
|
-
topic = Topic.create_from_hash(topic_hash)
|
17
|
+
let(:topic) do
|
18
|
+
Topic.create_from_hash(topic_hash)
|
19
|
+
end
|
14
20
|
|
21
|
+
it "should create a new instance" do
|
15
22
|
expect(topic.id).to eq(1)
|
16
23
|
expect(topic.label).to eq("Sports")
|
17
24
|
expect(topic.wiki_link).to eq("link_to_wiki")
|
data/textrazor.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textrazor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anuj Dutta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 3.0.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: dotenv
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.0'
|
83
97
|
description: Api wrapper for text razor
|
84
98
|
email:
|
85
99
|
- anuj@andhapp.com
|
@@ -89,6 +103,8 @@ extra_rdoc_files: []
|
|
89
103
|
files:
|
90
104
|
- ".gitignore"
|
91
105
|
- ".rspec"
|
106
|
+
- ".ruby-gemset"
|
107
|
+
- ".ruby-version"
|
92
108
|
- Gemfile
|
93
109
|
- LICENSE.txt
|
94
110
|
- README.md
|
@@ -96,20 +112,31 @@ files:
|
|
96
112
|
- lib/textrazor.rb
|
97
113
|
- lib/textrazor/client.rb
|
98
114
|
- lib/textrazor/configuration.rb
|
115
|
+
- lib/textrazor/entailment.rb
|
99
116
|
- lib/textrazor/entity.rb
|
100
117
|
- lib/textrazor/phrase.rb
|
118
|
+
- lib/textrazor/property.rb
|
119
|
+
- lib/textrazor/relation.rb
|
120
|
+
- lib/textrazor/relation_param.rb
|
101
121
|
- lib/textrazor/request.rb
|
102
122
|
- lib/textrazor/response.rb
|
123
|
+
- lib/textrazor/sentence.rb
|
103
124
|
- lib/textrazor/topic.rb
|
104
125
|
- lib/textrazor/util.rb
|
105
126
|
- lib/textrazor/version.rb
|
106
127
|
- lib/textrazor/word.rb
|
128
|
+
- spec/functional/service_spec.rb
|
107
129
|
- spec/lib/textrazor/client_spec.rb
|
108
130
|
- spec/lib/textrazor/configuration_spec.rb
|
131
|
+
- spec/lib/textrazor/entailment_spec.rb
|
109
132
|
- spec/lib/textrazor/entity_spec.rb
|
110
133
|
- spec/lib/textrazor/phrase_spec.rb
|
134
|
+
- spec/lib/textrazor/property_spec.rb
|
135
|
+
- spec/lib/textrazor/relation_param_spec.rb
|
136
|
+
- spec/lib/textrazor/relation_spec.rb
|
111
137
|
- spec/lib/textrazor/request_spec.rb
|
112
138
|
- spec/lib/textrazor/response_spec.rb
|
139
|
+
- spec/lib/textrazor/sentence_spec.rb
|
113
140
|
- spec/lib/textrazor/topic_spec.rb
|
114
141
|
- spec/lib/textrazor/word_spec.rb
|
115
142
|
- spec/lib/textrazor_spec.rb
|
@@ -140,12 +167,18 @@ signing_key:
|
|
140
167
|
specification_version: 4
|
141
168
|
summary: An api wrapper for text razor in ruby
|
142
169
|
test_files:
|
170
|
+
- spec/functional/service_spec.rb
|
143
171
|
- spec/lib/textrazor/client_spec.rb
|
144
172
|
- spec/lib/textrazor/configuration_spec.rb
|
173
|
+
- spec/lib/textrazor/entailment_spec.rb
|
145
174
|
- spec/lib/textrazor/entity_spec.rb
|
146
175
|
- spec/lib/textrazor/phrase_spec.rb
|
176
|
+
- spec/lib/textrazor/property_spec.rb
|
177
|
+
- spec/lib/textrazor/relation_param_spec.rb
|
178
|
+
- spec/lib/textrazor/relation_spec.rb
|
147
179
|
- spec/lib/textrazor/request_spec.rb
|
148
180
|
- spec/lib/textrazor/response_spec.rb
|
181
|
+
- spec/lib/textrazor/sentence_spec.rb
|
149
182
|
- spec/lib/textrazor/topic_spec.rb
|
150
183
|
- spec/lib/textrazor/word_spec.rb
|
151
184
|
- spec/lib/textrazor_spec.rb
|