Class: StanfordParser::FeatureLabel

Inherits:
Rjb::JavaObjectWrapper show all
Defined in:
lib/stanfordparser.rb

Overview

This is a wrapper for edu.stanford.nlp.ling.FeatureLabel objects. It customizes stringification.

Instance Attribute Summary

Attributes inherited from Rjb::JavaObjectWrapper

#java_object

Instance Method Summary collapse

Methods inherited from Rjb::JavaObjectWrapper

#each, #method_missing

Constructor Details

#initialize(obj = "edu.stanford.nlp.ling.FeatureLabel") ⇒ FeatureLabel

Returns a new instance of FeatureLabel.



196
197
198
# File 'lib/stanfordparser.rb', line 196

def initialize(obj = "edu.stanford.nlp.ling.FeatureLabel")
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rjb::JavaObjectWrapper

Instance Method Details

#inspectObject

More verbose stringification with all the fields and their values.



210
211
212
# File 'lib/stanfordparser.rb', line 210

def inspect
  toString
end

#to_sObject

Stringify with just the token and its begin and end position.



201
202
203
204
205
206
207
# File 'lib/stanfordparser.rb', line 201

def to_s
  # BUGBUG The position values come back as java.lang.Integer though I
  # would expect Rjb to convert them to Ruby integers.
  begin_position = get(self.BEGIN_POSITION_KEY)
  end_position = get(self.END_POSITION_KEY)
  "#{current} [#{begin_position},#{end_position}]"
end