Class: WordNet::Pointer
- Inherits:
-
Object
- Object
- WordNet::Pointer
- Defined in:
- lib/rwordnet/pointer.rb
Overview
Pointers represent the relations between the words in one synset and another.
Instance Attribute Summary collapse
-
#offset ⇒ Object
readonly
The offset, in bytes, of this pointer in WordNet’s internal database.
-
#pos ⇒ Object
readonly
The part of speech this pointer represents.
-
#source ⇒ Object
readonly
The synset from which this pointer…points.
-
#symbol ⇒ Object
readonly
The symbol that devices the relationship this pointer represents, e.g.
-
#target ⇒ Object
readonly
The synset to which this pointer…points.
Instance Method Summary collapse
-
#initialize(symbol: raise, offset: raise, pos: raise, source: raise) ⇒ Pointer
constructor
Create a pointer.
- #is_semantic? ⇒ Boolean
Constructor Details
#initialize(symbol: raise, offset: raise, pos: raise, source: raise) ⇒ Pointer
Create a pointer. Pointers represent the relations between the words in one synset and another, and are referenced by a shorthand symbol (e.g. ‘!’ for verb antonym). The list of valid pointer symbols is defined in pointers.rb
23 24 25 26 |
# File 'lib/rwordnet/pointer.rb', line 23 def initialize(symbol: raise, offset: raise, pos: raise, source: raise) @symbol, @offset, @pos, @source = symbol, offset, pos, source @target = source.slice!(2,2) end |
Instance Attribute Details
#offset ⇒ Object (readonly)
The offset, in bytes, of this pointer in WordNet’s internal database.
9 10 11 |
# File 'lib/rwordnet/pointer.rb', line 9 def offset @offset end |
#pos ⇒ Object (readonly)
The part of speech this pointer represents. One of ‘n’, ‘v’, ‘a’ (adjective), or ‘r’ (adverb).
12 13 14 |
# File 'lib/rwordnet/pointer.rb', line 12 def pos @pos end |
#source ⇒ Object (readonly)
The synset from which this pointer…points.
15 16 17 |
# File 'lib/rwordnet/pointer.rb', line 15 def source @source end |
#symbol ⇒ Object (readonly)
The symbol that devices the relationship this pointer represents, e.g. “!” for verb antonym. Valid pointer symbols are defined in pointers.rb
6 7 8 |
# File 'lib/rwordnet/pointer.rb', line 6 def symbol @symbol end |
#target ⇒ Object (readonly)
The synset to which this pointer…points.
18 19 20 |
# File 'lib/rwordnet/pointer.rb', line 18 def target @target end |
Instance Method Details
#is_semantic? ⇒ Boolean
28 29 30 |
# File 'lib/rwordnet/pointer.rb', line 28 def is_semantic? source == "00" && target == "00" end |