Class: VnTagger::Word

Inherits:
Object
  • Object
show all
Defined in:
lib/vn_tagger/word.rb

Constant Summary collapse

WORD_POSITIONS =
{
  'Np' => 'Proper noun',
  'Nc' => 'Classifier',
  'Nu' => 'Unit noun',
  'N' => 'Common noun',
  'V' => 'Verb',
  'A' => 'Adjective',
  'P' => 'Pronoun',
  'R' => 'Adverb',
  'L' => 'Determiner',
  'M' => 'Numeral',
  'E' => 'Preposition',
  'C' => 'Subordinating conjunction',
  'CC' => 'Coordinating conjunction',
  'I' => 'Interjection',
  'T' => 'Auxiliary, modal words',
  'Y' => 'Abbreviation',
  'Z' => 'Bound morphemes',
  'X' => 'Unknown'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(position, text) ⇒ Word

Returns a new instance of Word.



26
27
28
29
# File 'lib/vn_tagger/word.rb', line 26

def initialize(position, text)
  @position = position
  @text = text
end

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position.



3
4
5
# File 'lib/vn_tagger/word.rb', line 3

def position
  @position
end

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/vn_tagger/word.rb', line 3

def text
  @text
end

Instance Method Details

#is_tag?(tag = 'Proper noun') ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/vn_tagger/word.rb', line 31

def is_tag?(tag = 'Proper noun')
  WORD_POSITIONS[position] == tag
end