Class: CRFPP::Feature
- Inherits:
-
Struct
- Object
- Struct
- CRFPP::Feature
- Defined in:
- lib/crfpp/feature.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#id ⇒ Object
Returns the value of attribute id.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #identified? ⇒ Boolean
- #identifier(base = id) ⇒ Object
-
#initialize(content = Macro.new, type = :U, id = nil) ⇒ Feature
constructor
A new instance of Feature.
- #to_s(number = id) ⇒ Object
Constructor Details
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content
3 4 5 |
# File 'lib/crfpp/feature.rb', line 3 def content @content end |
#id ⇒ Object
Returns the value of attribute id
3 4 5 |
# File 'lib/crfpp/feature.rb', line 3 def id @id end |
#type ⇒ Object
Returns the value of attribute type
3 4 5 |
# File 'lib/crfpp/feature.rb', line 3 def type @type end |
Class Method Details
Instance Method Details
#identified? ⇒ Boolean
27 28 29 |
# File 'lib/crfpp/feature.rb', line 27 def identified? !id.nil? end |
#identifier(base = id) ⇒ Object
19 20 21 |
# File 'lib/crfpp/feature.rb', line 19 def identifier(base = id) base.is_a?(Numeric) ? ('%02d' % base) : base end |
#to_s(number = id) ⇒ Object
23 24 25 |
# File 'lib/crfpp/feature.rb', line 23 def to_s(number = id) [type.to_s.upcase, identifier(number), ':', content].compact.join end |