Class: NLP::Token

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

Direct Known Subclasses

Emoticon, Word

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(orth, tags) ⇒ Token

Returns a new instance of Token.



8
9
10
11
# File 'lib/token.rb', line 8

def initialize(orth,tags)
    @orth = orth
    @tags = tags
end

Instance Attribute Details

#orthObject (readonly)

Returns the value of attribute orth.



4
5
6
# File 'lib/token.rb', line 4

def orth
  @orth
end

#tagsObject (readonly)

Returns the value of attribute tags.



5
6
7
# File 'lib/token.rb', line 5

def tags
  @tags
end

Instance Method Details

#float?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/token.rb', line 29

def float?
    @tags.include?("tnum:frac")
end

#integer?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/token.rb', line 25

def integer?
    @tags.include?("tnum:integer")
end

#interp?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/token.rb', line 13

def interp?
    @tags.eql? "interp"
end

#number?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/token.rb', line 21

def number?
    @tags.include?("tnum")
end

#word?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/token.rb', line 17

def word?
    not interp? and not number?
end