Class: Lingo::Database::Source::SingleWord

Inherits:
Lingo::Database::Source show all
Defined in:
lib/lingo/database/source/single_word.rb

Overview

– Abgeleitet von Source behandelt die Klasse Dateien mit dem Format SingleWord. Eine Zeile "Fachbegriff\n" wird gewandelt in [ 'fachbegriff', ['#s'] ]. Die Wortklasse kann über den Parameter def-wc beeinflusst werden. ++

Constant Summary collapse

DEFAULT_DEF_WC =
Language::LA_NOUN

Constants inherited from Lingo::Database::Source

DEFAULT_SEPARATOR, LEXICAL_SEPARATOR, MAX_LENGTH

Instance Attribute Summary

Attributes inherited from Lingo::Database::Source

#pos

Instance Method Summary collapse

Methods inherited from Lingo::Database::Source

#each, #each_dump, #each_lexical, #each_line, from_config, from_id, lexicals, #rejected, #set, #size

Constructor Details

#initializeSingleWord

Returns a new instance of SingleWord.



43
44
45
46
47
# File 'lib/lingo/database/source/single_word.rb', line 43

def initialize(*)
  super
  @pat = /^(#{@wrd})$/
  @mul = @config.fetch('def-mul-wc', @def).downcase
end

Instance Method Details

#dump_line(key, val) ⇒ Object



53
54
55
# File 'lib/lingo/database/source/single_word.rb', line 53

def dump_line(key, val, *)
  key
end

#parse_line(line, key, val) ⇒ Object



49
50
51
# File 'lib/lingo/database/source/single_word.rb', line 49

def parse_line(line, key, val)
  [k = key.strip, [lexical(k, k.include?(' ') ? @mul : @def)]]
end