relevanced_client 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gen-rb/relevanced.rb +98 -24
- data/lib/gen-rb/relevanced_protocol_types.rb +12 -0
- data/lib/relevanced_client.rb +15 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cfbb94cc9b83b3745ad86f79943ff17e7a01364
|
4
|
+
data.tar.gz: cd25f89bbe88682a5a0fdc8d63c4fe467c396282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8db0cd77c42e3ac15921e367fac4c516beadb6aa9eae40f82f1930e89108c7ee91b17555f9a22ff3f8cfcfa230e46d051906f76495dc6b161bf1ec893cf45b69
|
7
|
+
data.tar.gz: 5534643a689d514ea1cf277485a4906e49c42ae4273441a4b60870c5850a82f8b6ebba5657c2d1f7db824bfaf684aeb1e6275b0c14f57d37f5fc19d15a9139e7
|
data/lib/gen-rb/relevanced.rb
CHANGED
@@ -74,13 +74,13 @@ module Relevanced
|
|
74
74
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'multiGetDocumentSimilarity failed: unknown result')
|
75
75
|
end
|
76
76
|
|
77
|
-
def multiGetTextSimilarity(centroidIds, text)
|
78
|
-
send_multiGetTextSimilarity(centroidIds, text)
|
77
|
+
def multiGetTextSimilarity(centroidIds, text, lang)
|
78
|
+
send_multiGetTextSimilarity(centroidIds, text, lang)
|
79
79
|
return recv_multiGetTextSimilarity()
|
80
80
|
end
|
81
81
|
|
82
|
-
def send_multiGetTextSimilarity(centroidIds, text)
|
83
|
-
send_message('multiGetTextSimilarity', MultiGetTextSimilarity_args, :centroidIds => centroidIds, :text => text)
|
82
|
+
def send_multiGetTextSimilarity(centroidIds, text, lang)
|
83
|
+
send_message('multiGetTextSimilarity', MultiGetTextSimilarity_args, :centroidIds => centroidIds, :text => text, :lang => lang)
|
84
84
|
end
|
85
85
|
|
86
86
|
def recv_multiGetTextSimilarity()
|
@@ -90,13 +90,13 @@ module Relevanced
|
|
90
90
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'multiGetTextSimilarity failed: unknown result')
|
91
91
|
end
|
92
92
|
|
93
|
-
def getTextSimilarity(centroidId, text)
|
94
|
-
send_getTextSimilarity(centroidId, text)
|
93
|
+
def getTextSimilarity(centroidId, text, lang)
|
94
|
+
send_getTextSimilarity(centroidId, text, lang)
|
95
95
|
return recv_getTextSimilarity()
|
96
96
|
end
|
97
97
|
|
98
|
-
def send_getTextSimilarity(centroidId, text)
|
99
|
-
send_message('getTextSimilarity', GetTextSimilarity_args, :centroidId => centroidId, :text => text)
|
98
|
+
def send_getTextSimilarity(centroidId, text, lang)
|
99
|
+
send_message('getTextSimilarity', GetTextSimilarity_args, :centroidId => centroidId, :text => text, :lang => lang)
|
100
100
|
end
|
101
101
|
|
102
102
|
def recv_getTextSimilarity()
|
@@ -122,13 +122,13 @@ module Relevanced
|
|
122
122
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getCentroidSimilarity failed: unknown result')
|
123
123
|
end
|
124
124
|
|
125
|
-
def createDocument(text)
|
126
|
-
send_createDocument(text)
|
125
|
+
def createDocument(text, language)
|
126
|
+
send_createDocument(text, language)
|
127
127
|
return recv_createDocument()
|
128
128
|
end
|
129
129
|
|
130
|
-
def send_createDocument(text)
|
131
|
-
send_message('createDocument', CreateDocument_args, :text => text)
|
130
|
+
def send_createDocument(text, language)
|
131
|
+
send_message('createDocument', CreateDocument_args, :text => text, :language => language)
|
132
132
|
end
|
133
133
|
|
134
134
|
def recv_createDocument()
|
@@ -137,13 +137,13 @@ module Relevanced
|
|
137
137
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'createDocument failed: unknown result')
|
138
138
|
end
|
139
139
|
|
140
|
-
def createDocumentWithID(id, text)
|
141
|
-
send_createDocumentWithID(id, text)
|
140
|
+
def createDocumentWithID(id, text, language)
|
141
|
+
send_createDocumentWithID(id, text, language)
|
142
142
|
return recv_createDocumentWithID()
|
143
143
|
end
|
144
144
|
|
145
|
-
def send_createDocumentWithID(id, text)
|
146
|
-
send_message('createDocumentWithID', CreateDocumentWithID_args, :id => id, :text => text)
|
145
|
+
def send_createDocumentWithID(id, text, language)
|
146
|
+
send_message('createDocumentWithID', CreateDocumentWithID_args, :id => id, :text => text, :language => language)
|
147
147
|
end
|
148
148
|
|
149
149
|
def recv_createDocumentWithID()
|
@@ -377,6 +377,21 @@ module Relevanced
|
|
377
377
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listAllDocuments failed: unknown result')
|
378
378
|
end
|
379
379
|
|
380
|
+
def listUnusedDocuments(limit)
|
381
|
+
send_listUnusedDocuments(limit)
|
382
|
+
return recv_listUnusedDocuments()
|
383
|
+
end
|
384
|
+
|
385
|
+
def send_listUnusedDocuments(limit)
|
386
|
+
send_message('listUnusedDocuments', ListUnusedDocuments_args, :limit => limit)
|
387
|
+
end
|
388
|
+
|
389
|
+
def recv_listUnusedDocuments()
|
390
|
+
result = receive_message(ListUnusedDocuments_result)
|
391
|
+
return result.success unless result.success.nil?
|
392
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listUnusedDocuments failed: unknown result')
|
393
|
+
end
|
394
|
+
|
380
395
|
def listDocumentRange(offset, count)
|
381
396
|
send_listDocumentRange(offset, count)
|
382
397
|
return recv_listDocumentRange()
|
@@ -502,7 +517,7 @@ module Relevanced
|
|
502
517
|
args = read_args(iprot, MultiGetTextSimilarity_args)
|
503
518
|
result = MultiGetTextSimilarity_result.new()
|
504
519
|
begin
|
505
|
-
result.success = @handler.multiGetTextSimilarity(args.centroidIds, args.text)
|
520
|
+
result.success = @handler.multiGetTextSimilarity(args.centroidIds, args.text, args.lang)
|
506
521
|
rescue ::ECentroidDoesNotExist => err
|
507
522
|
result.err = err
|
508
523
|
end
|
@@ -513,7 +528,7 @@ module Relevanced
|
|
513
528
|
args = read_args(iprot, GetTextSimilarity_args)
|
514
529
|
result = GetTextSimilarity_result.new()
|
515
530
|
begin
|
516
|
-
result.success = @handler.getTextSimilarity(args.centroidId, args.text)
|
531
|
+
result.success = @handler.getTextSimilarity(args.centroidId, args.text, args.lang)
|
517
532
|
rescue ::ECentroidDoesNotExist => err
|
518
533
|
result.err = err
|
519
534
|
end
|
@@ -534,7 +549,7 @@ module Relevanced
|
|
534
549
|
def process_createDocument(seqid, iprot, oprot)
|
535
550
|
args = read_args(iprot, CreateDocument_args)
|
536
551
|
result = CreateDocument_result.new()
|
537
|
-
result.success = @handler.createDocument(args.text)
|
552
|
+
result.success = @handler.createDocument(args.text, args.language)
|
538
553
|
write_result(result, oprot, 'createDocument', seqid)
|
539
554
|
end
|
540
555
|
|
@@ -542,7 +557,7 @@ module Relevanced
|
|
542
557
|
args = read_args(iprot, CreateDocumentWithID_args)
|
543
558
|
result = CreateDocumentWithID_result.new()
|
544
559
|
begin
|
545
|
-
result.success = @handler.createDocumentWithID(args.id, args.text)
|
560
|
+
result.success = @handler.createDocumentWithID(args.id, args.text, args.language)
|
546
561
|
rescue ::EDocumentAlreadyExists => err
|
547
562
|
result.err = err
|
548
563
|
end
|
@@ -695,6 +710,13 @@ module Relevanced
|
|
695
710
|
write_result(result, oprot, 'listAllDocuments', seqid)
|
696
711
|
end
|
697
712
|
|
713
|
+
def process_listUnusedDocuments(seqid, iprot, oprot)
|
714
|
+
args = read_args(iprot, ListUnusedDocuments_args)
|
715
|
+
result = ListUnusedDocuments_result.new()
|
716
|
+
result.success = @handler.listUnusedDocuments(args.limit)
|
717
|
+
write_result(result, oprot, 'listUnusedDocuments', seqid)
|
718
|
+
end
|
719
|
+
|
698
720
|
def process_listDocumentRange(seqid, iprot, oprot)
|
699
721
|
args = read_args(iprot, ListDocumentRange_args)
|
700
722
|
result = ListDocumentRange_result.new()
|
@@ -883,15 +905,20 @@ module Relevanced
|
|
883
905
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
884
906
|
CENTROIDIDS = 1
|
885
907
|
TEXT = 2
|
908
|
+
LANG = 3
|
886
909
|
|
887
910
|
FIELDS = {
|
888
911
|
CENTROIDIDS => {:type => ::Thrift::Types::LIST, :name => 'centroidIds', :element => {:type => ::Thrift::Types::STRING}},
|
889
|
-
TEXT => {:type => ::Thrift::Types::STRING, :name => 'text'}
|
912
|
+
TEXT => {:type => ::Thrift::Types::STRING, :name => 'text'},
|
913
|
+
LANG => {:type => ::Thrift::Types::I32, :name => 'lang', :enum_class => ::Language}
|
890
914
|
}
|
891
915
|
|
892
916
|
def struct_fields; FIELDS; end
|
893
917
|
|
894
918
|
def validate
|
919
|
+
unless @lang.nil? || ::Language::VALID_VALUES.include?(@lang)
|
920
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field lang!')
|
921
|
+
end
|
895
922
|
end
|
896
923
|
|
897
924
|
::Thrift::Struct.generate_accessors self
|
@@ -919,15 +946,20 @@ module Relevanced
|
|
919
946
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
920
947
|
CENTROIDID = 1
|
921
948
|
TEXT = 2
|
949
|
+
LANG = 3
|
922
950
|
|
923
951
|
FIELDS = {
|
924
952
|
CENTROIDID => {:type => ::Thrift::Types::STRING, :name => 'centroidId'},
|
925
|
-
TEXT => {:type => ::Thrift::Types::STRING, :name => 'text'}
|
953
|
+
TEXT => {:type => ::Thrift::Types::STRING, :name => 'text'},
|
954
|
+
LANG => {:type => ::Thrift::Types::I32, :name => 'lang', :enum_class => ::Language}
|
926
955
|
}
|
927
956
|
|
928
957
|
def struct_fields; FIELDS; end
|
929
958
|
|
930
959
|
def validate
|
960
|
+
unless @lang.nil? || ::Language::VALID_VALUES.include?(@lang)
|
961
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field lang!')
|
962
|
+
end
|
931
963
|
end
|
932
964
|
|
933
965
|
::Thrift::Struct.generate_accessors self
|
@@ -990,14 +1022,19 @@ module Relevanced
|
|
990
1022
|
class CreateDocument_args
|
991
1023
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
992
1024
|
TEXT = 1
|
1025
|
+
LANGUAGE = 2
|
993
1026
|
|
994
1027
|
FIELDS = {
|
995
|
-
TEXT => {:type => ::Thrift::Types::STRING, :name => 'text'}
|
1028
|
+
TEXT => {:type => ::Thrift::Types::STRING, :name => 'text'},
|
1029
|
+
LANGUAGE => {:type => ::Thrift::Types::I32, :name => 'language', :enum_class => ::Language}
|
996
1030
|
}
|
997
1031
|
|
998
1032
|
def struct_fields; FIELDS; end
|
999
1033
|
|
1000
1034
|
def validate
|
1035
|
+
unless @language.nil? || ::Language::VALID_VALUES.include?(@language)
|
1036
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field language!')
|
1037
|
+
end
|
1001
1038
|
end
|
1002
1039
|
|
1003
1040
|
::Thrift::Struct.generate_accessors self
|
@@ -1023,15 +1060,20 @@ module Relevanced
|
|
1023
1060
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1024
1061
|
ID = 1
|
1025
1062
|
TEXT = 2
|
1063
|
+
LANGUAGE = 3
|
1026
1064
|
|
1027
1065
|
FIELDS = {
|
1028
1066
|
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
1029
|
-
TEXT => {:type => ::Thrift::Types::STRING, :name => 'text'}
|
1067
|
+
TEXT => {:type => ::Thrift::Types::STRING, :name => 'text'},
|
1068
|
+
LANGUAGE => {:type => ::Thrift::Types::I32, :name => 'language', :enum_class => ::Language}
|
1030
1069
|
}
|
1031
1070
|
|
1032
1071
|
def struct_fields; FIELDS; end
|
1033
1072
|
|
1034
1073
|
def validate
|
1074
|
+
unless @language.nil? || ::Language::VALID_VALUES.include?(@language)
|
1075
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field language!')
|
1076
|
+
end
|
1035
1077
|
end
|
1036
1078
|
|
1037
1079
|
::Thrift::Struct.generate_accessors self
|
@@ -1545,6 +1587,38 @@ module Relevanced
|
|
1545
1587
|
::Thrift::Struct.generate_accessors self
|
1546
1588
|
end
|
1547
1589
|
|
1590
|
+
class ListUnusedDocuments_args
|
1591
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1592
|
+
LIMIT = 1
|
1593
|
+
|
1594
|
+
FIELDS = {
|
1595
|
+
LIMIT => {:type => ::Thrift::Types::I64, :name => 'limit'}
|
1596
|
+
}
|
1597
|
+
|
1598
|
+
def struct_fields; FIELDS; end
|
1599
|
+
|
1600
|
+
def validate
|
1601
|
+
end
|
1602
|
+
|
1603
|
+
::Thrift::Struct.generate_accessors self
|
1604
|
+
end
|
1605
|
+
|
1606
|
+
class ListUnusedDocuments_result
|
1607
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1608
|
+
SUCCESS = 0
|
1609
|
+
|
1610
|
+
FIELDS = {
|
1611
|
+
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::ListDocumentsResponse}
|
1612
|
+
}
|
1613
|
+
|
1614
|
+
def struct_fields; FIELDS; end
|
1615
|
+
|
1616
|
+
def validate
|
1617
|
+
end
|
1618
|
+
|
1619
|
+
::Thrift::Struct.generate_accessors self
|
1620
|
+
end
|
1621
|
+
|
1548
1622
|
class ListDocumentRange_args
|
1549
1623
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1550
1624
|
OFFSET = 1
|
@@ -6,6 +6,18 @@
|
|
6
6
|
|
7
7
|
require 'thrift'
|
8
8
|
|
9
|
+
module Language
|
10
|
+
DE = 0
|
11
|
+
EN = 1
|
12
|
+
ES = 2
|
13
|
+
FR = 3
|
14
|
+
IT = 4
|
15
|
+
RU = 5
|
16
|
+
OTHER = 254
|
17
|
+
VALUE_MAP = {0 => "DE", 1 => "EN", 2 => "ES", 3 => "FR", 4 => "IT", 5 => "RU", 254 => "OTHER"}
|
18
|
+
VALID_VALUES = Set.new([DE, EN, ES, FR, IT, RU, OTHER]).freeze
|
19
|
+
end
|
20
|
+
|
9
21
|
class WordVectorDTO
|
10
22
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
11
23
|
MAGNITUDE = 1
|
data/lib/relevanced_client.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
$:.push('gen-rb')
|
2
2
|
|
3
3
|
require 'thrift'
|
4
|
-
require File.join(File.dirname(__FILE__), 'gen-rb', 'relevanced')
|
5
4
|
|
6
5
|
module RelevancedClient
|
7
6
|
|
7
|
+
require File.join(File.dirname(__FILE__), 'gen-rb', 'relevanced')
|
8
|
+
require File.join(File.dirname(__FILE__), 'gen-rb', 'relevanced_protocol_types')
|
9
|
+
|
8
10
|
class Client
|
9
11
|
def initialize(host, port)
|
10
12
|
@host = host
|
@@ -31,9 +33,9 @@ module RelevancedClient
|
|
31
33
|
@thrift_client.getDocumentSimilarity(centroid_id, document_id)
|
32
34
|
end
|
33
35
|
|
34
|
-
def multi_get_text_similarity(centroid_id_list, text)
|
36
|
+
def multi_get_text_similarity(centroid_id_list, text, lang=Language::EN)
|
35
37
|
@thrift_client.multiGetTextSimilarity(
|
36
|
-
centroid_id_list, text
|
38
|
+
centroid_id_list, text, lang
|
37
39
|
)
|
38
40
|
end
|
39
41
|
|
@@ -43,8 +45,8 @@ module RelevancedClient
|
|
43
45
|
)
|
44
46
|
end
|
45
47
|
|
46
|
-
def get_text_similarity(centroid_id, text)
|
47
|
-
@thrift_client.getTextSimilarity(centroid_id, text)
|
48
|
+
def get_text_similarity(centroid_id, text, lang=Language::EN)
|
49
|
+
@thrift_client.getTextSimilarity(centroid_id, text, lang)
|
48
50
|
end
|
49
51
|
|
50
52
|
def get_centroid_similarity(centroid_1_id, centroid_2_id)
|
@@ -53,13 +55,13 @@ module RelevancedClient
|
|
53
55
|
)
|
54
56
|
end
|
55
57
|
|
56
|
-
def create_document(text)
|
57
|
-
@thrift_client.createDocument(text)
|
58
|
+
def create_document(text, lang=Language::EN)
|
59
|
+
@thrift_client.createDocument(text, lang)
|
58
60
|
end
|
59
61
|
|
60
|
-
def create_document_with_id(document_id, text)
|
62
|
+
def create_document_with_id(document_id, text, lang=Language::EN)
|
61
63
|
@thrift_client.createDocumentWithID(
|
62
|
-
document_id, text
|
64
|
+
document_id, text, lang
|
63
65
|
)
|
64
66
|
end
|
65
67
|
|
@@ -126,5 +128,9 @@ module RelevancedClient
|
|
126
128
|
def list_document_range_from_id(document_id, count)
|
127
129
|
@thrift_client.listDocumentRangeFromID(document_id, count)
|
128
130
|
end
|
131
|
+
|
132
|
+
def list_unused_documents(limit)
|
133
|
+
@thrift_client.listUnusedDocuments(limit)
|
134
|
+
end
|
129
135
|
end
|
130
136
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relevanced_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Ivey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thrift
|