poliqarpr 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/changelog.txt +4 -0
- data/lib/poliqarpr/client.rb +9 -3
- data/lib/poliqarpr/config.rb +8 -1
- data/poliqarpr.gemspec +1 -1
- data/spec/client.rb +6 -0
- metadata +2 -2
data/changelog.txt
CHANGED
data/lib/poliqarpr/client.rb
CHANGED
@@ -26,7 +26,7 @@ module Poliqarp
|
|
26
26
|
@debug = debug
|
27
27
|
@logger = STDOUT
|
28
28
|
@connector = Connector.new(self)
|
29
|
-
@config = Config.new(self,
|
29
|
+
@config = Config.new(self,5000)
|
30
30
|
@answer_queue = Queue.new
|
31
31
|
@waiting_mutex = Mutex.new
|
32
32
|
@query_mutex = Mutex.new
|
@@ -54,7 +54,7 @@ module Poliqarp
|
|
54
54
|
close if @session
|
55
55
|
@connector.open("localhost",port)
|
56
56
|
talk("MAKE-SESSION #{@session_name}")
|
57
|
-
|
57
|
+
resize_buffer(config.buffer_size)
|
58
58
|
@session = true
|
59
59
|
end
|
60
60
|
|
@@ -228,7 +228,13 @@ module Poliqarp
|
|
228
228
|
result
|
229
229
|
end
|
230
230
|
|
231
|
-
protected
|
231
|
+
protected
|
232
|
+
|
233
|
+
# Resizes the result buffer.
|
234
|
+
def resize_buffer(size)
|
235
|
+
talk("BUFFER-RESIZE #{size}")
|
236
|
+
end
|
237
|
+
|
232
238
|
# Set the size of the left context.
|
233
239
|
def left_context=(value)
|
234
240
|
result = talk("SET left-context-width #{value}")
|
data/lib/poliqarpr/config.rb
CHANGED
@@ -8,13 +8,20 @@ module Poliqarp
|
|
8
8
|
GROUPS = [:left_context, :left_match, :right_match, :right_context]
|
9
9
|
# The size of the buffer is the maximum number of excerpts which
|
10
10
|
# are returned for single query.
|
11
|
-
|
11
|
+
attr_reader :buffer_size
|
12
|
+
attr_accessor :left_context_size, :right_context_size, :tags, :lemmata
|
12
13
|
|
13
14
|
def initialize(client,buffer_size)
|
14
15
|
@client = client
|
15
16
|
@buffer_size = buffer_size
|
16
17
|
end
|
17
18
|
|
19
|
+
# Sets the result buffer size.
|
20
|
+
def buffer_size=(size)
|
21
|
+
@buffer_size = size
|
22
|
+
@client.send(:resize_buffer,size)
|
23
|
+
end
|
24
|
+
|
18
25
|
# Sets the size of the left short context. It must be > 0
|
19
26
|
#
|
20
27
|
# The size of the left short context is the number
|
data/poliqarpr.gemspec
CHANGED
data/spec/client.rb
CHANGED
@@ -66,6 +66,12 @@ describe Poliqarp::Client do
|
|
66
66
|
@client.close
|
67
67
|
end
|
68
68
|
|
69
|
+
it "should resize the result buffer" do
|
70
|
+
# the size of the buffer is 5000 by default
|
71
|
+
@client.config.buffer_size = 5010
|
72
|
+
@client.find("a").size.should == 5010
|
73
|
+
end
|
74
|
+
|
69
75
|
it "should allow to set and get the right context size" do
|
70
76
|
@client.config.right_context_size = 5
|
71
77
|
@client.config.right_context_size.should == 5
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: poliqarpr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.9
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Aleksander Pohl
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-10 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|