Class: PROIEL::Converter::TNT

Inherits:
Object
  • Object
show all
Defined in:
lib/proiel/cli/converters/tnt.rb

Class Method Summary collapse

Class Method Details

.process(tb, options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/proiel/cli/converters/tnt.rb', line 5

def process(tb, options)
  tb.sources.each do |source|
    puts "%% Source #{source.id}"
    puts '--'

    source.divs.each do |div|
      div.sentences.each do |sentence|
        puts "%% Sentence #{sentence.id}"
        sentence.tokens.each do |token|
          unless token.form.nil?
            if options['morphology']
              puts [token.form, token.pos + token.morphology].join("\t")
            else
              puts [token.form, token.pos].join("\t")
            end
          end
        end
        puts '--'
      end
    end
  end
end