retort_api 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/retort_api.rb +11 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a33de567af7e389092a64f6828b991c7fed4a65
|
4
|
+
data.tar.gz: 1ce119f2fbf790e20a4fcf6ad5f9b4bc8222662f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9db6b4d6ca5f111760217a2e2ca3300abcbe8226ff48a8448e61d0266c947308d48d1497bf263140426f91387a65c074989490b03780aea7d9a6dab5220c862d
|
7
|
+
data.tar.gz: f2e536c76c592fee9f1568aa2dfac4c63132fce006ea97fb4cc3a78568640d52546ec60ea889dee6b91f6c7fcf9c24a5d9c3f82bfffd8ae2f64b091bf95d83b0
|
data/lib/retort_api.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class RetortApi
|
2
2
|
require 'httparty'
|
3
3
|
|
4
|
-
#TODO: Identity mirroring for
|
4
|
+
#TODO: Identity mirroring for retort endpoints
|
5
5
|
#TODO: Rate limiting as needed
|
6
6
|
#TODO: HTTPS on API
|
7
7
|
#TODO: Handle failed requests to Retort
|
@@ -53,43 +53,43 @@ class RetortApi
|
|
53
53
|
].join).body
|
54
54
|
end
|
55
55
|
|
56
|
-
def self.get_word_before after_word
|
56
|
+
def self.get_word_before after_word, identity: {}
|
57
57
|
json = JSON.parse HTTParty.get([
|
58
58
|
BASE_URL,
|
59
59
|
'/bigram/prior',
|
60
|
-
"?after=#{after_word}"
|
60
|
+
"?after=#{after_word}#{parameterize_hash identity}"
|
61
61
|
].join).body
|
62
62
|
|
63
63
|
json["prior"]
|
64
64
|
end
|
65
65
|
|
66
|
-
def self.get_all_words_before after_word
|
66
|
+
def self.get_all_words_before after_word, identity: {}
|
67
67
|
JSON.parse HTTParty.get([
|
68
68
|
BASE_URL,
|
69
69
|
'/bigram/antecedents',
|
70
|
-
"?after=#{after_word}"
|
70
|
+
"?after=#{after_word}#{parameterize_hash identity}"
|
71
71
|
].join).body
|
72
72
|
end
|
73
73
|
|
74
|
-
def self.get_word_after previous_word
|
74
|
+
def self.get_word_after previous_word, identity: {}
|
75
75
|
json = JSON.parse HTTParty.get([
|
76
76
|
BASE_URL,
|
77
77
|
'/bigram/next',
|
78
|
-
"?prior=#{previous_word}"
|
78
|
+
"?prior=#{previous_word}#{parameterize_hash identity}"
|
79
79
|
].join).body
|
80
80
|
|
81
81
|
json["after"]
|
82
82
|
end
|
83
83
|
|
84
|
-
def self.get_all_words_after previous_word
|
84
|
+
def self.get_all_words_after previous_word, identity: {}
|
85
85
|
JSON.parse HTTParty.get([
|
86
86
|
BASE_URL,
|
87
87
|
'/bigram/consequents',
|
88
|
-
"?prior=#{previous_word}"
|
88
|
+
"?prior=#{previous_word}#{parameterize_hash identity}"
|
89
89
|
].join).body
|
90
90
|
end
|
91
91
|
|
92
|
-
def self.add_bigram prior, after, identity:
|
92
|
+
def self.add_bigram prior, after, identity: {}
|
93
93
|
JSON.parse HTTParty.get([
|
94
94
|
BASE_URL,
|
95
95
|
'/bigram/add',
|
@@ -97,7 +97,7 @@ class RetortApi
|
|
97
97
|
].join).body
|
98
98
|
end
|
99
99
|
|
100
|
-
def self.parse_bigram message, identity:
|
100
|
+
def self.parse_bigram message, identity: {}
|
101
101
|
JSON.parse HTTParty.get([
|
102
102
|
BASE_URL,
|
103
103
|
'/bigram/parse',
|