Class: Reina::LdixLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/reina/ldix_loader.rb

Class Method Summary collapse

Class Method Details

.load(file) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/reina/ldix_loader.rb', line 3

def self.load(file)
  file.map do |line|
    line.chomp.split(/:|:[<>]:/).map do |col|
      toks = col.split(/(<\w+>)/)
      {headword: toks[0],
        tags: toks[1..-1].map{|t| t[1..-2]}}
    end
  end
end