Module: Lumix
- Defined in:
- lib/lumix/concordancer.rb,
lib/lumix/base.rb,
lib/lumix/filter.rb,
lib/lumix/lookup.rb,
lib/lumix/fast_search.rb,
lib/lumix/slow_search.rb,
lib/lumix/proto/lookup.rb,
lib/lumix/text_snippet.rb,
lib/lumix/lookup_filter.rb,
lib/lumix/lookup_search.rb,
lib/lumix/proto/lookup_filter.rb,
lib/lumix/proto/lookup_search.rb
Overview
require ‘lumix/fast_search’
Defined Under Namespace
Classes: Concordancer, ConfigStruct, FastSearch, Filter, Lookup, LookupFilter, LookupSearch, Progress, SlowSearch, TextSnippet
Constant Summary
collapse
- Texts =
{:search => "Searching...", :read => "Importing files", :link => "Linking texts"}
- CONF =
'config.yaml'
- CConfig =
if File.exists?(CONF)
YAML.load_file(CONF)
else
conf = ConfigStruct.new('jdbc:postgresql://localhost:5433/concordancer?user=concordancer&password=concordancer')
File.open(CONF, 'w') do |f|
f.write(conf.to_yaml)
end
conf
end
- SearchStrategy =
LookupSearch
- WORKERS =
(ENV['LUMIX_WORKERS'] || 20).to_i
- RELINK =
ENV['LUMIX_RELINK']
- DB_VERSION =
4
- TEXT_ID =
0
- S_BEGIN =
1
- S_END =
2
- T_BEGIN =
3
- T_END =
4
Instance Method Summary
collapse
Instance Method Details
#correct(*ids) ⇒ Object
44
45
46
|
# File 'lib/lumix/base.rb', line 44
def correct(*ids)
conc.correct *ids
end
|
#create_concordancer(opts = {}) ⇒ Object
52
53
54
|
# File 'lib/lumix/base.rb', line 52
def create_concordancer(opts = {})
Concordancer.new(CConfig.database_uri, opts.merge(:progress_proc => progress_proc))
end
|
#import_files(lang, *path) ⇒ Object
22
23
24
25
|
# File 'lib/lumix/base.rb', line 22
def import_files(lang, *path)
conc.tp.lang = lang
conc.read(path)
end
|
#link ⇒ Object
36
37
38
|
# File 'lib/lumix/base.rb', line 36
def link
conc.link
end
|
#reconnect(opts = {}) ⇒ Object
40
41
42
|
# File 'lib/lumix/base.rb', line 40
def reconnect(opts = {})
@conc = create_concordancer(opts)
end
|
#relink ⇒ Object
27
28
29
|
# File 'lib/lumix/base.rb', line 27
def relink
conc.link!
end
|
#simulate_link ⇒ Object
31
32
33
34
|
# File 'lib/lumix/base.rb', line 31
def simulate_link
conc.simulate!
conc.link!
end
|
#to_filename(filter) ⇒ Object
48
49
50
|
# File 'lib/lumix/base.rb', line 48
def to_filename(filter)
filter.gsub(/\s+/, "_").gsub(/[\.\"]/, '')
end
|