Class: RMMSeg::Token
- Inherits:
-
Object
- Object
- RMMSeg::Token
- Defined in:
- lib/rmmseg/token.rb
Overview
A Token consists of a term’s text and the start and end offset of the term.
Instance Attribute Summary collapse
-
#end_pos ⇒ Object
readonly
The one greater than the position of the last byte of the token.
-
#start_pos ⇒ Object
readonly
The start position of the token.
-
#text ⇒ Object
readonly
Text of the token.
Instance Method Summary collapse
-
#initialize(text, start_pos, end_pos) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(text, start_pos, end_pos) ⇒ Token
Returns a new instance of Token.
16 17 18 19 20 |
# File 'lib/rmmseg/token.rb', line 16 def initialize(text, start_pos, end_pos) @text = text @start_pos = start_pos @end_pos = end_pos end |
Instance Attribute Details
#end_pos ⇒ Object (readonly)
The one greater than the position of the last byte of the token. This is byte index instead of character.
14 15 16 |
# File 'lib/rmmseg/token.rb', line 14 def end_pos @end_pos end |
#start_pos ⇒ Object (readonly)
The start position of the token. This is byte index instead of character.
10 11 12 |
# File 'lib/rmmseg/token.rb', line 10 def start_pos @start_pos end |
#text ⇒ Object (readonly)
Text of the token.
6 7 8 |
# File 'lib/rmmseg/token.rb', line 6 def text @text end |