Class: Ve::Word
- Inherits:
-
Object
- Object
- Ve::Word
- Defined in:
- lib/word.rb
Instance Attribute Summary collapse
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#info ⇒ Object
Returns the value of attribute info.
-
#lemma ⇒ Object
Returns the value of attribute lemma.
-
#part_of_speech ⇒ Object
Returns the value of attribute part_of_speech.
-
#tokens ⇒ Object
Returns the value of attribute tokens.
-
#word ⇒ Object
Returns the value of attribute word.
Instance Method Summary collapse
- #as_json ⇒ Object
- #base_form ⇒ Object
- #inflected? ⇒ Boolean
-
#initialize(word, lemma, part_of_speech, tokens, extra = {}, info = {}) ⇒ Word
constructor
TODO: More elegance.
-
#main_part ⇒ Object
TODO: the main part of a word, for example 重要 in 重要な.
Constructor Details
#initialize(word, lemma, part_of_speech, tokens, extra = {}, info = {}) ⇒ Word
TODO: More elegance
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/word.rb', line 7 def initialize(word, lemma, part_of_speech, tokens, extra = {}, info = {}) @word = word.dup @lemma = lemma.dup @part_of_speech = part_of_speech @tokens = tokens # TODO: I don't like this, it's too unstructured @extra = extra @info = info end |
Instance Attribute Details
#extra ⇒ Object
Returns the value of attribute extra.
4 5 6 |
# File 'lib/word.rb', line 4 def extra @extra end |
#info ⇒ Object
Returns the value of attribute info.
4 5 6 |
# File 'lib/word.rb', line 4 def info @info end |
#lemma ⇒ Object
Returns the value of attribute lemma.
4 5 6 |
# File 'lib/word.rb', line 4 def lemma @lemma end |
#part_of_speech ⇒ Object
Returns the value of attribute part_of_speech.
4 5 6 |
# File 'lib/word.rb', line 4 def part_of_speech @part_of_speech end |
#tokens ⇒ Object
Returns the value of attribute tokens.
4 5 6 |
# File 'lib/word.rb', line 4 def tokens @tokens end |
#word ⇒ Object
Returns the value of attribute word.
4 5 6 |
# File 'lib/word.rb', line 4 def word @word end |
Instance Method Details
#as_json ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/word.rb', line 30 def as_json { :_class => 'Word', :word => @word, :lemma => @lemma, :part_of_speech => @part_of_speech.name, :tokens => @tokens, :extra => @extra, :info => @info } end |
#base_form ⇒ Object
22 23 24 |
# File 'lib/word.rb', line 22 def base_form @lemma end |
#inflected? ⇒ Boolean
26 27 28 |
# File 'lib/word.rb', line 26 def inflected? @word != @lemma end |
#main_part ⇒ Object
TODO: the main part of a word, for example 重要 in 重要な
19 20 |
# File 'lib/word.rb', line 19 def main_part end |