picky 2.7.0 → 3.0.0.pre1
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.
- data/lib/picky/adapters/rack/base.rb +20 -16
- data/lib/picky/adapters/rack/live_parameters.rb +28 -24
- data/lib/picky/adapters/rack/search.rb +67 -0
- data/lib/picky/adapters/rack.rb +27 -23
- data/lib/picky/application.rb +246 -236
- data/lib/picky/backend/base.rb +115 -119
- data/lib/picky/backend/file/basic.rb +102 -98
- data/lib/picky/backend/file/json.rb +27 -23
- data/lib/picky/backend/file/marshal.rb +32 -28
- data/lib/picky/backend/file/text.rb +45 -41
- data/lib/picky/backend/files.rb +19 -15
- data/lib/picky/backend/redis/basic.rb +76 -72
- data/lib/picky/backend/redis/list_hash.rb +40 -36
- data/lib/picky/backend/redis/string_hash.rb +30 -26
- data/lib/picky/backend/redis.rb +32 -28
- data/lib/picky/bundle.rb +82 -57
- data/lib/{bundling.rb → picky/bundling.rb} +0 -0
- data/lib/picky/calculations/location.rb +51 -47
- data/lib/picky/categories.rb +60 -56
- data/lib/picky/categories_indexed.rb +73 -82
- data/lib/picky/categories_indexing.rb +12 -8
- data/lib/picky/category.rb +109 -120
- data/lib/picky/category_indexed.rb +39 -41
- data/lib/picky/category_indexing.rb +123 -125
- data/lib/picky/character_substituters/west_european.rb +32 -26
- data/lib/{constants.rb → picky/constants.rb} +0 -0
- data/lib/picky/cores.rb +96 -92
- data/lib/{deployment.rb → picky/deployment.rb} +0 -0
- data/lib/picky/frontend_adapters/rack.rb +133 -118
- data/lib/picky/generators/aliases.rb +5 -3
- data/lib/picky/generators/base.rb +11 -7
- data/lib/picky/generators/partial/default.rb +7 -3
- data/lib/picky/generators/partial/none.rb +24 -20
- data/lib/picky/generators/partial/strategy.rb +20 -16
- data/lib/picky/generators/partial/substring.rb +94 -90
- data/lib/picky/generators/partial_generator.rb +11 -7
- data/lib/picky/generators/similarity/default.rb +9 -5
- data/lib/picky/generators/similarity/double_metaphone.rb +20 -16
- data/lib/picky/generators/similarity/metaphone.rb +20 -16
- data/lib/picky/generators/similarity/none.rb +23 -19
- data/lib/picky/generators/similarity/phonetic.rb +49 -45
- data/lib/picky/generators/similarity/soundex.rb +20 -16
- data/lib/picky/generators/similarity/strategy.rb +10 -6
- data/lib/picky/generators/similarity_generator.rb +11 -7
- data/lib/picky/generators/strategy.rb +14 -10
- data/lib/picky/generators/weights/default.rb +9 -5
- data/lib/picky/generators/weights/logarithmic.rb +30 -26
- data/lib/picky/generators/weights/strategy.rb +10 -6
- data/lib/picky/generators/weights_generator.rb +11 -7
- data/lib/picky/helpers/measuring.rb +20 -16
- data/lib/picky/indexed/bundle/base.rb +39 -37
- data/lib/picky/indexed/bundle/memory.rb +68 -64
- data/lib/picky/indexed/bundle/redis.rb +73 -69
- data/lib/picky/indexed/wrappers/bundle/calculation.rb +26 -22
- data/lib/picky/indexed/wrappers/bundle/location.rb +30 -26
- data/lib/picky/indexed/wrappers/bundle/wrapper.rb +36 -32
- data/lib/picky/indexed/wrappers/category/location.rb +17 -13
- data/lib/picky/indexed/wrappers/exact_first.rb +46 -42
- data/lib/picky/indexers/base.rb +26 -22
- data/lib/picky/indexers/parallel.rb +62 -58
- data/lib/picky/indexers/serial.rb +41 -37
- data/lib/picky/indexes/index.rb +400 -0
- data/lib/picky/indexes/index_indexed.rb +24 -0
- data/lib/picky/indexes/index_indexing.rb +138 -0
- data/lib/picky/indexes/memory.rb +20 -0
- data/lib/picky/indexes/redis.rb +20 -0
- data/lib/picky/indexes.rb +68 -61
- data/lib/picky/indexes_indexed.rb +16 -12
- data/lib/picky/indexes_indexing.rb +41 -37
- data/lib/picky/indexing/bundle/base.rb +216 -205
- data/lib/picky/indexing/bundle/memory.rb +16 -11
- data/lib/picky/indexing/bundle/redis.rb +14 -12
- data/lib/picky/indexing/wrappers/category/location.rb +17 -13
- data/lib/picky/interfaces/live_parameters.rb +159 -154
- data/lib/picky/loader.rb +267 -304
- data/lib/picky/loggers/search.rb +20 -13
- data/lib/picky/no_source_specified_exception.rb +7 -3
- data/lib/picky/performant.rb +6 -2
- data/lib/picky/query/allocation.rb +71 -67
- data/lib/picky/query/allocations.rb +99 -94
- data/lib/picky/query/combination.rb +70 -66
- data/lib/picky/query/combinations/base.rb +56 -52
- data/lib/picky/query/combinations/memory.rb +36 -32
- data/lib/picky/query/combinations/redis.rb +66 -62
- data/lib/picky/query/indexes.rb +175 -160
- data/lib/picky/query/qualifier_category_mapper.rb +43 -0
- data/lib/picky/query/token.rb +165 -172
- data/lib/picky/query/tokens.rb +86 -82
- data/lib/picky/query/weights.rb +44 -48
- data/lib/picky/query.rb +5 -1
- data/lib/picky/rack/harakiri.rb +51 -47
- data/lib/picky/results.rb +81 -77
- data/lib/picky/search.rb +169 -158
- data/lib/picky/sinatra.rb +34 -0
- data/lib/picky/sources/base.rb +73 -70
- data/lib/picky/sources/couch.rb +61 -57
- data/lib/picky/sources/csv.rb +68 -64
- data/lib/picky/sources/db.rb +139 -135
- data/lib/picky/sources/delicious.rb +52 -48
- data/lib/picky/sources/mongo.rb +68 -63
- data/lib/picky/sources/wrappers/base.rb +20 -16
- data/lib/picky/sources/wrappers/location.rb +37 -33
- data/lib/picky/statistics.rb +46 -43
- data/lib/picky/tasks.rb +3 -0
- data/lib/picky/tokenizers/base.rb +192 -187
- data/lib/picky/tokenizers/index.rb +25 -21
- data/lib/picky/tokenizers/location.rb +33 -29
- data/lib/picky/tokenizers/query.rb +49 -43
- data/lib/picky.rb +21 -13
- data/lib/tasks/application.rake +1 -1
- data/lib/tasks/index.rake +3 -3
- data/lib/tasks/routes.rake +1 -1
- data/lib/tasks/server.rake +1 -1
- data/spec/lib/adapters/rack/base_spec.rb +1 -1
- data/spec/lib/adapters/rack/live_parameters_spec.rb +1 -1
- data/spec/lib/adapters/rack/query_spec.rb +1 -1
- data/spec/lib/application_spec.rb +39 -32
- data/spec/lib/backend/file/basic_spec.rb +2 -2
- data/spec/lib/backend/file/json_spec.rb +2 -2
- data/spec/lib/backend/file/marshal_spec.rb +2 -2
- data/spec/lib/backend/file/text_spec.rb +1 -1
- data/spec/lib/backend/files_spec.rb +14 -24
- data/spec/lib/backend/redis/basic_spec.rb +2 -2
- data/spec/lib/backend/redis/list_hash_spec.rb +3 -3
- data/spec/lib/backend/redis/string_hash_spec.rb +3 -3
- data/spec/lib/backend/redis_spec.rb +20 -13
- data/spec/lib/calculations/location_spec.rb +1 -1
- data/spec/lib/categories_indexed_spec.rb +16 -34
- data/spec/lib/category_indexed_spec.rb +9 -27
- data/spec/lib/category_indexing_spec.rb +2 -3
- data/spec/lib/category_spec.rb +10 -10
- data/spec/lib/character_substituters/west_european_spec.rb +6 -5
- data/spec/lib/cores_spec.rb +17 -17
- data/spec/lib/extensions/symbol_spec.rb +15 -1
- data/spec/lib/frontend_adapters/rack_spec.rb +20 -20
- data/spec/lib/generators/aliases_spec.rb +3 -3
- data/spec/lib/generators/cacher_strategy_spec.rb +1 -1
- data/spec/lib/generators/partial/default_spec.rb +3 -3
- data/spec/lib/generators/partial/none_spec.rb +2 -2
- data/spec/lib/generators/partial/substring_spec.rb +1 -1
- data/spec/lib/generators/partial_generator_spec.rb +3 -3
- data/spec/lib/generators/similarity/double_metaphone_spec.rb +1 -1
- data/spec/lib/generators/similarity/metaphone_spec.rb +1 -1
- data/spec/lib/generators/similarity/none_spec.rb +1 -1
- data/spec/lib/generators/similarity/phonetic_spec.rb +1 -1
- data/spec/lib/generators/similarity/soundex_spec.rb +1 -1
- data/spec/lib/generators/similarity_generator_spec.rb +2 -2
- data/spec/lib/generators/weights/logarithmic_spec.rb +1 -1
- data/spec/lib/generators/weights_generator_spec.rb +1 -1
- data/spec/lib/helpers/measuring_spec.rb +2 -2
- data/spec/lib/indexed/bundle/memory_spec.rb +6 -6
- data/spec/lib/indexed/bundle/redis_spec.rb +4 -4
- data/spec/lib/indexed/wrappers/bundle/calculation_spec.rb +2 -3
- data/spec/lib/indexed/wrappers/bundle/wrapper_spec.rb +2 -2
- data/spec/lib/indexed/wrappers/exact_first_spec.rb +5 -5
- data/spec/lib/indexers/base_spec.rb +1 -1
- data/spec/lib/indexers/parallel_spec.rb +1 -1
- data/spec/lib/indexers/serial_spec.rb +1 -1
- data/spec/lib/{index/base_indexed_spec.rb → indexes/index_indexed_spec.rb} +3 -3
- data/spec/lib/{index/base_indexing_spec.rb → indexes/index_indexing_spec.rb} +19 -2
- data/spec/lib/{index/base_spec.rb → indexes/index_spec.rb} +6 -25
- data/spec/lib/{index → indexes}/redis_spec.rb +1 -1
- data/spec/lib/indexes_class_spec.rb +2 -2
- data/spec/lib/indexes_indexed_spec.rb +1 -1
- data/spec/lib/indexes_indexing_spec.rb +1 -1
- data/spec/lib/indexes_spec.rb +1 -1
- data/spec/lib/indexing/bundle/base_spec.rb +7 -5
- data/spec/lib/indexing/bundle/memory_partial_generation_speed_spec.rb +4 -4
- data/spec/lib/indexing/bundle/memory_spec.rb +15 -15
- data/spec/lib/indexing/bundle/redis_spec.rb +9 -9
- data/spec/lib/interfaces/live_parameters_spec.rb +5 -5
- data/spec/lib/loader_spec.rb +17 -19
- data/spec/lib/loggers/search_spec.rb +2 -2
- data/spec/lib/query/allocation_spec.rb +1 -1
- data/spec/lib/query/allocations_spec.rb +1 -1
- data/spec/lib/query/combination_spec.rb +4 -4
- data/spec/lib/query/combinations/base_spec.rb +1 -1
- data/spec/lib/query/combinations/memory_spec.rb +1 -1
- data/spec/lib/query/combinations/redis_spec.rb +1 -1
- data/spec/lib/query/indexes_spec.rb +7 -2
- data/spec/lib/query/qualifier_category_mapper_spec.rb +34 -0
- data/spec/lib/query/token_spec.rb +32 -53
- data/spec/lib/query/tokens_spec.rb +30 -35
- data/spec/lib/query/weights_spec.rb +16 -16
- data/spec/lib/rack/harakiri_spec.rb +5 -5
- data/spec/lib/results_spec.rb +1 -1
- data/spec/lib/search_spec.rb +24 -22
- data/spec/lib/sinatra_spec.rb +36 -0
- data/spec/lib/sources/base_spec.rb +1 -1
- data/spec/lib/sources/couch_spec.rb +9 -9
- data/spec/lib/sources/csv_spec.rb +7 -7
- data/spec/lib/sources/db_spec.rb +2 -2
- data/spec/lib/sources/delicious_spec.rb +5 -5
- data/spec/lib/sources/mongo_spec.rb +7 -7
- data/spec/lib/sources/wrappers/base_spec.rb +2 -2
- data/spec/lib/sources/wrappers/location_spec.rb +1 -1
- data/spec/lib/statistics_spec.rb +1 -1
- data/spec/lib/tokenizers/base_spec.rb +2 -2
- data/spec/lib/tokenizers/index_spec.rb +1 -1
- data/spec/lib/tokenizers/query_spec.rb +1 -1
- metadata +30 -30
- data/lib/picky/adapters/rack/query.rb +0 -65
- data/lib/picky/index/base.rb +0 -409
- data/lib/picky/index/base_indexed.rb +0 -29
- data/lib/picky/index/base_indexing.rb +0 -127
- data/lib/picky/index/memory.rb +0 -16
- data/lib/picky/index/redis.rb +0 -16
- data/lib/picky/query/qualifiers.rb +0 -76
- data/lib/picky/query/solr.rb +0 -60
- data/lib/picky/signals.rb +0 -8
- data/lib/picky-tasks.rb +0 -6
- data/lib/tasks/spec.rake +0 -11
- data/spec/lib/query/qualifiers_spec.rb +0 -31
|
@@ -1,182 +1,187 @@
|
|
|
1
|
-
|
|
2
|
-
# Only load if the user wants it.
|
|
3
|
-
#
|
|
4
|
-
module Interfaces
|
|
5
|
-
# This is an interface that provides the user of
|
|
6
|
-
# Picky with the possibility to change parameters
|
|
7
|
-
# while the Application is running.
|
|
8
|
-
#
|
|
9
|
-
# Important Note: This will only work in Master/Child configurations.
|
|
10
|
-
#
|
|
11
|
-
class LiveParameters
|
|
1
|
+
module Picky
|
|
12
2
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
# This is very optional.
|
|
4
|
+
# Only load if the user wants it.
|
|
5
|
+
#
|
|
6
|
+
module Interfaces
|
|
17
7
|
|
|
18
|
-
# This
|
|
8
|
+
# This is an interface that provides the user of
|
|
9
|
+
# Picky with the possibility to change parameters
|
|
10
|
+
# while the Application is running.
|
|
11
|
+
#
|
|
12
|
+
# Important Note: This will only work in Master/Child configurations.
|
|
19
13
|
#
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
class LiveParameters
|
|
15
|
+
|
|
16
|
+
def initialize
|
|
17
|
+
@child, @parent = IO.pipe
|
|
18
|
+
start_master_process_thread
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# This runs a thread that listens to child processes.
|
|
22
22
|
#
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
def start_master_process_thread
|
|
24
|
+
# This thread is stopped in the children.
|
|
25
|
+
#
|
|
26
|
+
Thread.new do
|
|
27
|
+
loop do
|
|
28
|
+
IO.select([@child], nil, nil, 2) or next
|
|
29
|
+
result = @child.gets ';;;'
|
|
30
|
+
pid, configuration_hash = eval result
|
|
31
|
+
next unless Hash === configuration_hash
|
|
32
|
+
next if configuration_hash.empty?
|
|
33
|
+
exclaim "Trying to update MASTER configuration."
|
|
34
|
+
try_updating_configuration_with configuration_hash
|
|
35
|
+
kill_each_worker_except pid
|
|
36
|
+
|
|
37
|
+
# Fails hard on an error.
|
|
38
|
+
#
|
|
39
|
+
end
|
|
36
40
|
end
|
|
37
41
|
end
|
|
38
|
-
end
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
# TODO This needs to be webserver agnostic.
|
|
44
|
+
#
|
|
45
|
+
def worker_pids
|
|
46
|
+
Unicorn::HttpServer::WORKERS.keys
|
|
47
|
+
end
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
# Taken from Unicorn.
|
|
50
|
+
#
|
|
51
|
+
def kill_each_worker_except pid
|
|
52
|
+
worker_pids.each do |wpid|
|
|
53
|
+
next if wpid == pid
|
|
54
|
+
kill_worker :KILL, wpid
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
def kill_worker signal, wpid
|
|
58
|
+
Process.kill signal, wpid
|
|
59
|
+
exclaim "Killing worker ##{wpid} with signal #{signal}."
|
|
60
|
+
rescue Errno::ESRCH
|
|
61
|
+
remove_worker wpid
|
|
62
|
+
end
|
|
63
|
+
# TODO This needs to be Webserver agnostic.
|
|
64
|
+
#
|
|
65
|
+
def remove_worker wpid
|
|
66
|
+
worker = Unicorn::HttpServer::WORKERS.delete(wpid) and worker.tmp.close rescue nil
|
|
52
67
|
end
|
|
53
|
-
end
|
|
54
|
-
def kill_worker signal, wpid
|
|
55
|
-
Process.kill signal, wpid
|
|
56
|
-
exclaim "Killing worker ##{wpid} with signal #{signal}."
|
|
57
|
-
rescue Errno::ESRCH
|
|
58
|
-
remove_worker wpid
|
|
59
|
-
end
|
|
60
|
-
# TODO This needs to be Webserver agnostic.
|
|
61
|
-
#
|
|
62
|
-
def remove_worker wpid
|
|
63
|
-
worker = Unicorn::HttpServer::WORKERS.delete(wpid) and worker.tmp.close rescue nil
|
|
64
|
-
end
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
#
|
|
69
|
-
# The params are a strictly defined hash of:
|
|
70
|
-
# * querying_removes_characters: Regexp
|
|
71
|
-
# * querying_stopwords: Regexp
|
|
72
|
-
# * querying_splits_text_on: Regexp
|
|
73
|
-
#
|
|
74
|
-
# This first tries to update in the child process,
|
|
75
|
-
# and if successful, in the parent process
|
|
76
|
-
#
|
|
77
|
-
def parameters configuration_hash
|
|
78
|
-
close_child
|
|
79
|
-
exclaim "Trying to update worker child configuration." unless configuration_hash.empty?
|
|
80
|
-
try_updating_configuration_with configuration_hash
|
|
81
|
-
write_parent configuration_hash
|
|
82
|
-
extract_configuration
|
|
83
|
-
rescue CouldNotUpdateConfigurationError => e
|
|
84
|
-
# I need to die such that my broken config is never used.
|
|
69
|
+
# Updates any parameters with the ones given and
|
|
70
|
+
# returns the updated params.
|
|
85
71
|
#
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
72
|
+
# The params are a strictly defined hash of:
|
|
73
|
+
# * querying_removes_characters: Regexp
|
|
74
|
+
# * querying_stopwords: Regexp
|
|
75
|
+
# * querying_splits_text_on: Regexp
|
|
76
|
+
#
|
|
77
|
+
# This first tries to update in the child process,
|
|
78
|
+
# and if successful, in the parent process
|
|
79
|
+
#
|
|
80
|
+
def parameters configuration_hash
|
|
81
|
+
close_child
|
|
82
|
+
exclaim "Trying to update worker child configuration." unless configuration_hash.empty?
|
|
83
|
+
try_updating_configuration_with configuration_hash
|
|
84
|
+
write_parent configuration_hash
|
|
85
|
+
extract_configuration
|
|
86
|
+
rescue CouldNotUpdateConfigurationError => e
|
|
87
|
+
# I need to die such that my broken config is never used.
|
|
88
|
+
#
|
|
89
|
+
exclaim "Child process #{Process.pid} performs harakiri because of broken config."
|
|
90
|
+
harakiri
|
|
91
|
+
{ e.config_key => :ERROR }
|
|
92
|
+
end
|
|
93
|
+
# Kills itself, but still answering the request honorably.
|
|
94
|
+
#
|
|
95
|
+
def harakiri
|
|
96
|
+
Process.kill :QUIT, Process.pid
|
|
97
|
+
end
|
|
98
|
+
# Write the parent.
|
|
99
|
+
#
|
|
100
|
+
# Note: The ;;; is the end marker for the message.
|
|
101
|
+
#
|
|
102
|
+
def write_parent configuration_hash
|
|
103
|
+
@parent.write "#{[Process.pid, configuration_hash]};;;"
|
|
104
|
+
end
|
|
105
|
+
# Close the child if it isn't yet closed.
|
|
106
|
+
#
|
|
107
|
+
def close_child
|
|
108
|
+
@child.close unless @child.closed?
|
|
109
|
+
end
|
|
107
110
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
class CouldNotUpdateConfigurationError < StandardError
|
|
112
|
+
attr_reader :config_key
|
|
113
|
+
def initialize config_key, message
|
|
114
|
+
super message
|
|
115
|
+
@config_key = config_key
|
|
116
|
+
end
|
|
113
117
|
end
|
|
114
|
-
end
|
|
115
118
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
# Tries updating the configuration in the child process or parent process.
|
|
120
|
+
#
|
|
121
|
+
def try_updating_configuration_with configuration_hash
|
|
122
|
+
current_key = nil
|
|
123
|
+
begin
|
|
124
|
+
configuration_hash.each_pair do |key, new_value|
|
|
125
|
+
exclaim " Setting #{key} with #{new_value}."
|
|
126
|
+
current_key = key
|
|
127
|
+
send :"#{key}=", new_value
|
|
128
|
+
end
|
|
129
|
+
rescue StandardError => e
|
|
130
|
+
# Catch any error and reraise as config error.
|
|
131
|
+
#
|
|
132
|
+
raise CouldNotUpdateConfigurationError.new current_key, e.message
|
|
125
133
|
end
|
|
126
|
-
rescue StandardError => e
|
|
127
|
-
# Catch any error and reraise as config error.
|
|
128
|
-
#
|
|
129
|
-
raise CouldNotUpdateConfigurationError.new current_key, e.message
|
|
130
134
|
end
|
|
131
|
-
end
|
|
132
135
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
def extract_configuration
|
|
137
|
+
{
|
|
138
|
+
querying_removes_characters: querying_removes_characters,
|
|
139
|
+
querying_stopwords: querying_stopwords,
|
|
140
|
+
querying_splits_text_on: querying_splits_text_on
|
|
141
|
+
}
|
|
142
|
+
end
|
|
140
143
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
144
|
+
# TODO Move to Interface object.
|
|
145
|
+
#
|
|
146
|
+
def querying_removes_characters
|
|
147
|
+
regexp = Tokenizers::Query.default.instance_variable_get :@removes_characters_regexp
|
|
148
|
+
regexp && regexp.source
|
|
149
|
+
end
|
|
150
|
+
def querying_removes_characters= new_value
|
|
151
|
+
Tokenizers::Query.default.instance_variable_set(:@removes_characters_regexp, %r{#{new_value}})
|
|
152
|
+
end
|
|
153
|
+
def querying_stopwords
|
|
154
|
+
regexp = Tokenizers::Query.default.instance_variable_get :@remove_stopwords_regexp
|
|
155
|
+
regexp && regexp.source
|
|
156
|
+
end
|
|
157
|
+
def querying_stopwords= new_value
|
|
158
|
+
Tokenizers::Query.default.instance_variable_set(:@remove_stopwords_regexp, %r{#{new_value}})
|
|
159
|
+
end
|
|
160
|
+
def querying_splits_text_on
|
|
161
|
+
splits = Tokenizers::Query.default.instance_variable_get :@splits_text_on
|
|
162
|
+
splits && splits.respond_to?(:source) ? splits.source : splits
|
|
163
|
+
end
|
|
164
|
+
def querying_splits_text_on= new_value
|
|
165
|
+
splits = Tokenizers::Query.default.instance_variable_get :@splits_text_on
|
|
166
|
+
if splits.respond_to?(:source)
|
|
167
|
+
Tokenizers::Query.default.instance_variable_set(:@splits_text_on, %r{#{new_value}})
|
|
168
|
+
else
|
|
169
|
+
Tokenizers::Query.default.instance_variable_set(:@splits_text_on, new_value)
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
#
|
|
174
|
+
#
|
|
175
|
+
def to_s
|
|
176
|
+
"Suckerfish Live Interface (Use the picky-live gem to introspect)"
|
|
167
177
|
end
|
|
168
|
-
end
|
|
169
178
|
|
|
170
|
-
#
|
|
171
|
-
#
|
|
172
|
-
def to_s
|
|
173
|
-
"Suckerfish Live Interface (Use the picky-live gem to introspect)"
|
|
174
179
|
end
|
|
175
180
|
|
|
176
181
|
end
|
|
177
182
|
|
|
178
183
|
# Aka.
|
|
179
184
|
#
|
|
180
|
-
|
|
185
|
+
LiveParameters = Interfaces::LiveParameters
|
|
181
186
|
|
|
182
187
|
end
|