lingo 1.8.4.2 → 1.8.5

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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +413 -325
  3. data/README +380 -131
  4. data/Rakefile +19 -21
  5. data/de/lingo-abk.txt +15 -17
  6. data/de/lingo-dic.txt +20210 -20659
  7. data/de/lingo-mul.txt +5 -13
  8. data/de/lingo-syn.txt +5 -8
  9. data/de/test_dic.txt +2 -0
  10. data/de/test_gen.txt +8 -0
  11. data/de/{test_mul2.txt → test_mu2.txt} +0 -0
  12. data/de/{test_singleword.txt → test_sgw.txt} +0 -0
  13. data/de/user-dic.txt +5 -7
  14. data/de.lang +64 -49
  15. data/en/lingo-dic.txt +6398 -6404
  16. data/en/lingo-irr.txt +2 -3
  17. data/en/lingo-mul.txt +6 -7
  18. data/en/lingo-wdn.txt +881 -1762
  19. data/en/user-dic.txt +2 -5
  20. data/en.lang +39 -39
  21. data/lib/lingo/app.rb +10 -6
  22. data/lib/lingo/attendee/abbreviator.rb +1 -0
  23. data/lib/lingo/attendee/decomposer.rb +2 -1
  24. data/lib/lingo/attendee/multi_worder.rb +5 -6
  25. data/lib/lingo/attendee/stemmer.rb +1 -1
  26. data/lib/lingo/attendee/synonymer.rb +4 -2
  27. data/lib/lingo/attendee/text_reader.rb +77 -57
  28. data/lib/lingo/attendee/text_writer.rb +1 -1
  29. data/lib/lingo/attendee/tokenizer.rb +101 -50
  30. data/lib/lingo/attendee/variator.rb +2 -1
  31. data/lib/lingo/attendee/vector_filter.rb +28 -6
  32. data/lib/lingo/attendee/word_searcher.rb +2 -1
  33. data/lib/lingo/attendee.rb +8 -4
  34. data/lib/lingo/call.rb +7 -3
  35. data/lib/lingo/cli.rb +8 -16
  36. data/lib/lingo/config.rb +11 -6
  37. data/lib/lingo/ctl.rb +54 -3
  38. data/lib/lingo/database/crypter.rb +8 -14
  39. data/lib/lingo/database/hash_store.rb +1 -1
  40. data/lib/lingo/database/{show_progress.rb → progress.rb} +7 -8
  41. data/lib/lingo/database/source/key_value.rb +6 -5
  42. data/lib/lingo/database/source/multi_key.rb +5 -2
  43. data/lib/lingo/database/source/multi_value.rb +6 -4
  44. data/lib/lingo/database/source/single_word.rb +2 -3
  45. data/lib/lingo/database/source/word_class.rb +24 -5
  46. data/lib/lingo/database/source.rb +5 -3
  47. data/lib/lingo/database.rb +102 -41
  48. data/lib/lingo/error.rb +24 -2
  49. data/lib/lingo/language/dictionary.rb +26 -54
  50. data/lib/lingo/language/grammar.rb +19 -23
  51. data/lib/lingo/language/lexical.rb +5 -1
  52. data/lib/lingo/language/lexical_hash.rb +7 -12
  53. data/lib/lingo/language/token.rb +10 -1
  54. data/lib/lingo/language/word.rb +35 -23
  55. data/lib/lingo/language/word_form.rb +5 -4
  56. data/lib/lingo/{show_progress.rb → progress.rb} +43 -30
  57. data/lib/lingo/srv/lingosrv.cfg +1 -1
  58. data/lib/lingo/srv/public/.gitkeep +0 -0
  59. data/lib/lingo/srv.rb +11 -6
  60. data/lib/lingo/version.rb +2 -2
  61. data/lib/lingo/web/lingoweb.cfg +1 -1
  62. data/lib/lingo/web/views/index.erb +4 -4
  63. data/lib/lingo/web.rb +4 -6
  64. data/lib/lingo.rb +4 -12
  65. data/lingo.cfg +1 -1
  66. data/lir.cfg +1 -1
  67. data/ru/lingo-dic.txt +33473 -2113
  68. data/ru/lingo-mul.txt +8430 -1913
  69. data/ru/lingo-syn.txt +1634 -0
  70. data/ru/user-dic.txt +6 -0
  71. data/ru.lang +49 -47
  72. data/spec/spec_helper.rb +4 -0
  73. data/test/attendee/ts_decomposer.rb +2 -2
  74. data/test/attendee/ts_synonymer.rb +3 -3
  75. data/test/attendee/ts_tokenizer.rb +215 -2
  76. data/test/attendee/ts_variator.rb +2 -2
  77. data/test/attendee/ts_word_searcher.rb +10 -6
  78. data/test/ref/artikel.seq +2 -2
  79. data/test/ref/artikel.vec +5 -5
  80. data/test/ref/artikel.ven +11 -11
  81. data/test/ref/artikel.ver +11 -11
  82. data/test/ref/lir.seq +13 -13
  83. data/test/ref/lir.vec +31 -31
  84. data/test/test_helper.rb +19 -5
  85. data/test/ts_database.rb +206 -77
  86. data/test/ts_language.rb +86 -26
  87. metadata +93 -49
  88. data/.rspec +0 -1
  89. data/de/test_syn2.txt +0 -1
data/en/user-dic.txt CHANGED
@@ -1,5 +1,2 @@
1
- #
2
- # Musterwörterbuch user-dic.txt als Vorlage
3
- # für eigene Benutzerwörterbücher
4
- #
5
- #
1
+ # Musterwörterbuch user-dic.txt als Vorlage
2
+ # für eigene Benutzerwörterbücher
data/en.lang CHANGED
@@ -40,62 +40,62 @@
40
40
  # definiert sein, da es sonst noch nicht existiert!
41
41
  #
42
42
 
43
- # lingo language definition
44
43
  ---
45
44
  language:
46
45
  name: 'Englisch'
47
46
 
48
47
  dictionary:
49
48
  databases:
50
- # Systemwörterbücher
49
+ # System dictionaries
51
50
  sys-dic: { name: en/lingo-dic.txt, txt-format: WordClass, separator: '=' }
52
- sys-syn: { name: en/lingo-syn.txt, txt-format: KeyValue, separator: '=', def-wc: y }
53
- sys-mul: { name: en/lingo-mul.txt, txt-format: SingleWord, use-lex: 'sys-dic', def-wc: m }
51
+ sys-syn: { name: en/lingo-syn.txt, txt-format: KeyValue, separator: '=', def-wc: y }
52
+ sys-mul: { name: en/lingo-mul.txt, txt-format: SingleWord, use-lex: sys-dic, def-wc: m }
54
53
  sys-irr: { name: en/lingo-irr.txt, txt-format: WordClass, separator: '=' }
55
54
  sys-wdn: { name: en/lingo-wdn.txt, txt-format: WordClass, separator: '=' }
56
- # Benutzerwörterbücher
57
- usr-dic: { name: en/user-dic.txt, txt-format: WordClass, separator: '=' }
55
+
56
+ # User dictionaries
57
+ usr-dic: { name: en/user-dic.txt, txt-format: WordClass, separator: '=' }
58
58
 
59
59
  compound:
60
- min-word-size: "7"
61
- min-part-size: "3"
62
- max-parts: "5"
63
- min-avg-part-size: "4"
64
- append-wordclass: "+"
60
+ min-word-size: '7'
61
+ min-part-size: '3'
62
+ max-parts: '5'
63
+ min-avg-part-size: '4'
64
+ append-wordclass: '+'
65
65
  skip-sequences: [ xx ]
66
66
 
67
67
  suffix:
68
- # Suffixliste, Stand: *****ENGLISCH****
69
- # Suffixklasse: s = Substantiv, a = Adjektiv, v = Verb, e = Eigenwort, f = Fugung
70
- # Suffixe je Klasse: "<suffix>['/'<ersetzung>][ <suffix>['/'<ersetzung>]]"
71
- - [s, " es s ves/f ves/fe ies/y "]
72
- - [a, " er est r st ier/y iest/y "]
73
- - [v, " d ed en es ing s ing/e "]
74
- - [e, " s "]
75
- - [f, ""]
68
+ # Suffixliste, Stand: *****ENGLISCH****
69
+ # Suffixklasse: s = Substantiv, a = Adjektiv, v = Verb, e = Eigenwort, f = Fugung
70
+ # Suffixe je Klasse: "<suffix>['/'<ersetzung>][ <suffix>['/'<ersetzung>]]"
71
+ - [s, 'es s ves/f ves/fe ies/y']
72
+ - [a, 'er est r st ier/y iest/y']
73
+ - [v, 'd ed en es ing s ing/e']
74
+ - [e, 's']
75
+ - [f, '']
76
76
 
77
77
  attendees:
78
78
  variator:
79
79
  variations:
80
- - [ ieh, sch ]
81
- - [ fec, see ]
82
- - [ it, st ]
83
- - [ fch, sch ]
84
- - [ fp, sp ]
85
- - [ f, s ]
86
- - [ c, e ]
87
- - [ ffc, sse ]
88
- - [ ff, ss ]
89
- - [ e, c ]
90
- - [ ni, m ]
91
- - [ feh, sch ]
92
- - [ lt, st ]
93
- - [ il, st ]
94
- - [ ftc, ste ]
95
- - [ ft, st ]
96
- - [ fl, st ]
97
- - [ li, h ]
98
- - [ i, s ]
80
+ - [ieh, sch]
81
+ - [fec, see]
82
+ - [it, st ]
83
+ - [fch, sch]
84
+ - [fp, sp ]
85
+ - [f, s ]
86
+ - [c, e ]
87
+ - [ffc, sse]
88
+ - [ff, ss ]
89
+ - [e, c ]
90
+ - [ni, m ]
91
+ - [feh, sch]
92
+ - [lt, st ]
93
+ - [il, st ]
94
+ - [ftc, ste]
95
+ - [ft, st ]
96
+ - [fl, st ]
97
+ - [li, h ]
98
+ - [i, s ]
99
99
 
100
100
  sequencer:
101
- sequences: [ [AS, "2, 1"], [AK, "2, 1"], [AAK, "3, 1 2"], [AAS, "3, 1 2"] ]
101
+ sequences: [ [AS, '2, 1'], [AK, '2, 1'], [AAK, '3, 1 2'], [AAS, '3, 1 2'] ]
data/lib/lingo/app.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # Lingo -- A full-featured automatic indexing system #
7
7
  # #
8
8
  # Copyright (C) 2005-2007 John Vorhauer #
9
- # Copyright (C) 2007-2012 John Vorhauer, Jens Wille #
9
+ # Copyright (C) 2007-2014 John Vorhauer, Jens Wille #
10
10
  # #
11
11
  # Lingo is free software; you can redistribute it and/or modify it under the #
12
12
  # terms of the GNU Affero General Public License as published by the Free #
@@ -27,19 +27,19 @@
27
27
  require 'json'
28
28
  require 'optparse'
29
29
  require 'shellwords'
30
- require 'sinatra/base'
31
- require 'sinatra/cookies'
30
+ require 'sinatra/bells'
32
31
 
33
32
  class Lingo
34
33
 
35
- class App < Sinatra::Base
34
+ class App < Sinatra::Bells
36
35
 
37
36
  class << self
38
37
 
39
38
  def init_app(file, *args, &block)
40
- set :root, File.chomp_ext(file)
39
+ set_root(file)
41
40
  parse_options(*args, &block)
42
- helpers Sinatra::Cookies
41
+
42
+ get('/about') { to_json(self.class, version: VERSION) }
43
43
  end
44
44
 
45
45
  def parse_options(lingo_options = false)
@@ -63,7 +63,11 @@ class Lingo
63
63
  o.on('-x', 'turn on the mutex lock (default is off)') { set :lock, true }
64
64
  }.parse!(argv)
65
65
 
66
+ abort banner unless argv.empty?
67
+
66
68
  ARGV.unshift(*yield) if block_given?
69
+ rescue OptionParser::ParseError => err
70
+ abort "#{err}\n#{banner}"
67
71
  end
68
72
 
69
73
  def rackup(name)
@@ -74,6 +74,7 @@ class Lingo
74
74
 
75
75
  def init
76
76
  set_dic
77
+ @abbr = nil
77
78
  end
78
79
 
79
80
  def control(cmd, param)
@@ -6,7 +6,7 @@
6
6
  # Lingo -- A full-featured automatic indexing system #
7
7
  # #
8
8
  # Copyright (C) 2005-2007 John Vorhauer #
9
- # Copyright (C) 2007-2012 John Vorhauer, Jens Wille #
9
+ # Copyright (C) 2007-2014 John Vorhauer, Jens Wille #
10
10
  # #
11
11
  # Lingo is free software; you can redistribute it and/or modify it under the #
12
12
  # terms of the GNU Affero General Public License as published by the Free #
@@ -80,6 +80,7 @@ class Lingo
80
80
  end
81
81
 
82
82
  def control(cmd, param)
83
+ # can control
83
84
  end
84
85
 
85
86
  def process(obj)
@@ -6,7 +6,7 @@
6
6
  # Lingo -- A full-featured automatic indexing system #
7
7
  # #
8
8
  # Copyright (C) 2005-2007 John Vorhauer #
9
- # Copyright (C) 2007-2012 John Vorhauer, Jens Wille #
9
+ # Copyright (C) 2007-2014 John Vorhauer, Jens Wille #
10
10
  # #
11
11
  # Lingo is free software; you can redistribute it and/or modify it under the #
12
12
  # terms of the GNU Affero General Public License as published by the Free #
@@ -86,7 +86,7 @@ class Lingo
86
86
  @combine = get_key('combine', false)
87
87
  @all = @combine.is_a?(String) && @combine.downcase == 'all'
88
88
 
89
- lex_src, lex_mod, d = nil, nil, @lingo.dictionary_config['databases']
89
+ lex_src, lex_mod, d = nil, nil, lingo.dictionary_config['databases']
90
90
 
91
91
  (mul_src = get_array('source')).each { |src|
92
92
  s, m = d[src].values_at('use-lex', 'lex-mode')
@@ -119,9 +119,8 @@ class Lingo
119
119
  def process_buffer
120
120
  unless form_at(0) == CHAR_PUNCT
121
121
  unless (res = check_multiword_key(3)).empty?
122
- len = res.map { |r|
123
- r.is_a?(Lexical) ? r.form.split(' ').size : r[/^\*(\d+)/, 1].to_i
124
- }.sort!.reverse!
122
+ len = res.map { |r| r.is_a?(Lexical) ? r.form.count(' ') + 1 : r }
123
+ len.sort!.reverse!
125
124
 
126
125
  unless (max = len.first) > 3
127
126
  create_and_forward_multiword(3, res)
@@ -201,7 +200,7 @@ class Lingo
201
200
 
202
201
  seq.shift.product(*seq) { |key|
203
202
  @mul_dic.select(key.join(' '), mul)
204
- break unless @all_keys || mul.empty?
203
+ break unless @all || mul.empty?
205
204
  } && mul.uniq!
206
205
 
207
206
  mul
@@ -42,7 +42,7 @@ class Lingo
42
42
  def process(obj)
43
43
  if obj.is_a?(Word) && obj.unknown?
44
44
  stem = stem(Unicode.downcase(obj.form), @all)
45
- obj.add_lexicals([Lexical.new(stem, @wc)]) if stem
45
+ obj << Lexical.new(stem, @wc) if stem
46
46
  end
47
47
 
48
48
  forward(obj)
@@ -6,7 +6,7 @@
6
6
  # Lingo -- A full-featured automatic indexing system #
7
7
  # #
8
8
  # Copyright (C) 2005-2007 John Vorhauer #
9
- # Copyright (C) 2007-2012 John Vorhauer, Jens Wille #
9
+ # Copyright (C) 2007-2014 John Vorhauer, Jens Wille #
10
10
  # #
11
11
  # Lingo is free software; you can redistribute it and/or modify it under the #
12
12
  # terms of the GNU Affero General Public License as published by the Free #
@@ -74,15 +74,17 @@ class Lingo
74
74
 
75
75
  def init
76
76
  set_dic
77
+ @com = !get_key('compound-parts', false)
77
78
  @skip = get_array('skip', WA_UNKNOWN, :upcase)
78
79
  end
79
80
 
80
81
  def control(cmd, param)
82
+ # can control
81
83
  end
82
84
 
83
85
  def process(obj)
84
86
  if obj.is_a?(Word) && !@skip.include?(obj.attr)
85
- obj.add_lexicals(@dic.find_synonyms(obj))
87
+ obj.add_lexicals(@dic.find_synonyms(obj, [], @com))
86
88
  end
87
89
 
88
90
  forward(obj)
@@ -6,7 +6,7 @@
6
6
  # Lingo -- A full-featured automatic indexing system #
7
7
  # #
8
8
  # Copyright (C) 2005-2007 John Vorhauer #
9
- # Copyright (C) 2007-2012 John Vorhauer, Jens Wille #
9
+ # Copyright (C) 2007-2013 John Vorhauer, Jens Wille #
10
10
  # #
11
11
  # Lingo is free software; you can redistribute it and/or modify it under the #
12
12
  # terms of the GNU Affero General Public License as published by the Free #
@@ -26,7 +26,7 @@
26
26
 
27
27
  require 'find'
28
28
 
29
- %w[filemagic mime/types hpricot pdf-reader].each { |lib|
29
+ %w[filemagic mime/types nokogiri nuggets/file/which pdf-reader].each { |lib|
30
30
  begin
31
31
  require lib
32
32
  rescue LoadError
@@ -115,7 +115,7 @@ class Lingo
115
115
  @filter = get_key('filter', false)
116
116
  @progress = get_key('progress', false)
117
117
 
118
- @lingo.deprecate('lir-record-pattern', :records, self) if has_key?('lir-record-pattern')
118
+ lingo.deprecate('lir-record-pattern', :records, self) if has_key?('lir-record-pattern')
119
119
 
120
120
  @lir = get_re('records', get_key('lir-record-pattern', nil), %r{^\[(\d+)\.\]}) # DEPRECATE lir-record-pattern
121
121
  @cut = get_re('fields', !!@lir, %r{^.+?:\s*})
@@ -135,16 +135,12 @@ class Lingo
135
135
  def spool(path)
136
136
  forward(STR_CMD_FILE, path)
137
137
 
138
- if stdin?(path)
139
- io = @lingo.config.stdin.set_encoding(ENC)
140
- io = StringIO.new(io.read) if @progress
141
- else
142
- io, name = File.open(path, 'rb', encoding: ENC), path
143
- end
138
+ io = !stdin?(path) ? open_file(name = path) :
139
+ string_or_io(lingo.config.stdin.set_encoding(ENC))
144
140
 
145
- ShowProgress.new(self, @progress && io.size, name) { |progress|
146
- filter(io) { |line, pos|
147
- progress[pos]
141
+ Progress.new(self, @progress && io.size, name) { |progress|
142
+ filter(io, path, progress) { |line, pos|
143
+ progress << pos
148
144
 
149
145
  line.chomp! if @chomp
150
146
  next if line =~ @skip
@@ -161,38 +157,56 @@ class Lingo
161
157
  forward(STR_CMD_EOF, path)
162
158
  end
163
159
 
164
- def filter(io)
160
+ def filter(io, path, progress)
165
161
  block = @progress ?
166
162
  lambda { |line| yield line, io.pos } :
167
163
  lambda { |line| yield line, 0 }
168
164
 
169
- case @filter == true ? file_type(path, io) : @filter.to_s
170
- when /html/i then io = filter_html(io)
171
- when /xml/i then io = filter_html(io, true)
172
- when /pdf/i then filter_pdf(io, &block); return
165
+ io = case @filter == true ? file_type(io, path) : @filter.to_s
166
+ when 'pdftotext' then filter_pdftotext(io, path, progress)
167
+ when /html/i then filter_html(io)
168
+ when /xml/i then filter_html(io, true)
169
+ when /pdf/i then filter_pdf(io, &block); return
170
+ else io
173
171
  end
174
172
 
175
- io.each_line(&block) if io
173
+ io.each_line(&block)
176
174
  end
177
175
 
178
- def filter_pdf(io, &block)
176
+ def filter_pdftotext(io, path, progress)
177
+ if cmd = File.which(name = 'pdftotext')
178
+ with_tempfile(name) { |tempfile|
179
+ pdf_path = stdin?(path) ? tempfile[:pdf, io] : path
180
+ system(cmd, '-q', pdf_path, txt_path = tempfile[:txt])
181
+
182
+ progress.init(File.size(txt_path)) if @progress
183
+ open_file(txt_path)
184
+ }
185
+ else
186
+ cancel_filter(:PDF, name, :command)
187
+ end
188
+ end
189
+
190
+ def filter_pdf(io)
179
191
  if Object.const_defined?(:PDF) && PDF.const_defined?(:Reader)
180
- PDFFilter.filter(io, &block)
192
+ PDF::Reader.new(io).pages.each { |page| yield page.text }
181
193
  else
182
- warn "PDF filter not available. Please install `pdf-reader'."
194
+ cancel_filter(:PDF, 'pdf-reader')
183
195
  end
184
196
  end
185
197
 
186
198
  def filter_html(io, xml = false)
187
- if Object.const_defined?(:Hpricot)
188
- Hpricot(io, xml: xml).inner_text
199
+ type = xml ? :XML : :HTML
200
+
201
+ if Object.const_defined?(:Nokogiri)
202
+ doc = Nokogiri.send(type, io, nil, ENC)
203
+ string_or_io(doc.children.map { |x| x.inner_text }.join)
189
204
  else
190
- warn "#{xml ? 'X' : 'HT'}ML filter not available. Please install `hpricot'."
191
- nil
205
+ cancel_filter(type, :nokogiri)
192
206
  end
193
207
  end
194
208
 
195
- def file_type(path, io)
209
+ def file_type(io, path)
196
210
  if Object.const_defined?(:FileMagic) && io.respond_to?(:rewind)
197
211
  type = FileMagic.fm(:mime, simplified: true).buffer(io.read(256))
198
212
  io.rewind
@@ -201,26 +215,56 @@ class Lingo
201
215
  if type = MIME::Types.of(path).first
202
216
  type.content_type
203
217
  else
204
- warn 'Filters not available. File type could not be determined.'
205
- nil
218
+ cancel('Filters not available. File type could not be determined.')
206
219
  end
207
220
  else
208
- warn "Filters not available. Please install `ruby-filemagic' or `mime-types'."
209
- nil
221
+ cancel("Filters not available. Please install the `ruby-filemagic' or `mime-types' gem.")
210
222
  end
211
223
  end
212
224
 
225
+ def cancel_filter(type, name, what = :gem)
226
+ cancel("#{type} filter not available. Please install the `#{name}' #{what}.")
227
+ end
228
+
229
+ def cancel(msg)
230
+ throw(:cancel, msg)
231
+ end
232
+
213
233
  def stdin?(path)
214
234
  %w[STDIN -].include?(path)
215
235
  end
216
236
 
237
+ def string_or_io(io)
238
+ @progress ? StringIO.new(io.is_a?(String) ? io : io.read) : io
239
+ end
240
+
241
+ def open_file(path)
242
+ File.open(path, 'rb', encoding: ENC)
243
+ end
244
+
245
+ def with_tempfile(name)
246
+ require 'tempfile'
247
+
248
+ tempfiles = []
249
+
250
+ yield lambda { |ext, io = nil|
251
+ tempfiles << temp = Tempfile.new([name, ".#{ext}"])
252
+ temp.write(io.read) if io
253
+ temp.close
254
+ temp.path
255
+ }
256
+ ensure
257
+ tempfiles.each(&:unlink)
258
+ end
259
+
217
260
  def get_files
218
261
  args = [get_key('glob', '*.txt'), get_key('recursive', false)]
219
262
 
220
263
  @files = []
221
264
 
222
265
  Array(get_key('files', '-')).each { |path|
223
- stdin?(path) ? @files << path : add_files(path, *args)
266
+ stdin?(path) ? @files << path :
267
+ add_files(File.expand_path(path), *args)
224
268
  }
225
269
  end
226
270
 
@@ -233,42 +277,18 @@ class Lingo
233
277
  if recursive
234
278
  Find.find(entry) { |match|
235
279
  if File.file?(match) && File.fnmatch?(glob, match)
236
- @files << File.expand_path(match)
280
+ @files << match
237
281
  end
238
282
  }
239
283
  else
240
284
  add_files(File.join(entry, glob), glob)
241
285
  end
242
286
  else
243
- @files << File.expand_path(entry)
287
+ @files << entry
244
288
  end
245
289
  }
246
290
  end
247
291
 
248
- class PDFFilter
249
-
250
- def self.filter(io, &block)
251
- PDF::Reader.new.parse(io, new(&block))
252
- end
253
-
254
- def initialize(&block)
255
- @block = block
256
- end
257
-
258
- def show_text(string, *params)
259
- @block[string << '|']
260
- end
261
-
262
- alias_method :super_show_text, :show_text
263
- alias_method :move_to_next_line_and_show_text, :show_text
264
- alias_method :set_spacing_next_line_show_text, :show_text
265
-
266
- def show_text_with_positioning(params, *)
267
- params.each { |param| show_text(param) if param.is_a?(String) }
268
- end
269
-
270
- end
271
-
272
292
  end
273
293
 
274
294
  # For backwards compatibility.
@@ -98,7 +98,7 @@ class Lingo
98
98
  @no_sep = true
99
99
 
100
100
  if stdout?(@ext)
101
- @filename, @file = @ext, @lingo.config.stdout
101
+ @filename, @file = @ext, lingo.config.stdout
102
102
  else
103
103
  @file = File.open(@filename = File.set_ext(param, ".#{@ext}"), 'w')
104
104
  end