Class: WordNet::Pointer

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

Overview

Pointers represent the relations between the words in one synset and another.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#offsetObject (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

#posObject (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

#sourceObject (readonly)

The synset from which this pointer…points.



15
16
17
# File 'lib/rwordnet/pointer.rb', line 15

def source
  @source
end

#symbolObject (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

#targetObject (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

Returns:

  • (Boolean)


28
29
30
# File 'lib/rwordnet/pointer.rb', line 28

def is_semantic?
  source == "00" && target == "00"
end