Class: VnTagger::Word
- Inherits:
-
Object
- Object
- VnTagger::Word
- 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
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(position, text) ⇒ Word
constructor
A new instance of Word.
- #is_tag?(tag = 'Proper noun') ⇒ Boolean
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
#position ⇒ Object (readonly)
Returns the value of attribute position.
3 4 5 |
# File 'lib/vn_tagger/word.rb', line 3 def position @position end |
#text ⇒ Object (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
31 32 33 |
# File 'lib/vn_tagger/word.rb', line 31 def is_tag?(tag = 'Proper noun') WORD_POSITIONS[position] == tag end |