Class: StanfordParser::Tree
- Inherits:
-
Rjb::JavaObjectWrapper
- Object
- Rjb::JavaObjectWrapper
- StanfordParser::Tree
- Defined in:
- lib/stanfordparser.rb
Overview
This is a wrapper for edu.stanford.nlp.trees.Tree
objects. It customizes stringification.
Instance Attribute Summary
Attributes inherited from Rjb::JavaObjectWrapper
Instance Method Summary collapse
-
#initialize(obj = "edu.stanford.nlp.trees.Tree") ⇒ Tree
constructor
A new instance of Tree.
-
#inspect ⇒ Object
Return the label along with the score if there is one.
-
#to_s ⇒ Object
The Penn treebank representation.
Methods inherited from Rjb::JavaObjectWrapper
Constructor Details
#initialize(obj = "edu.stanford.nlp.trees.Tree") ⇒ Tree
Returns a new instance of Tree.
155 156 157 |
# File 'lib/stanfordparser.rb', line 155 def initialize(obj = "edu.stanford.nlp.trees.Tree") super(obj) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rjb::JavaObjectWrapper
Instance Method Details
#inspect ⇒ Object
Return the label along with the score if there is one.
160 161 162 163 |
# File 'lib/stanfordparser.rb', line 160 def inspect s = "#{label}" + (score.nan? ? "" : " [#{sprintf '%.2f', score}]") "(#{s})" end |
#to_s ⇒ Object
The Penn treebank representation. This prints with indenting instead of putting everything on one line.
167 168 169 |
# File 'lib/stanfordparser.rb', line 167 def to_s "#{pennString}" end |