Class: Tokenizer::Transform
- Inherits:
-
Object
- Object
- Tokenizer::Transform
- Defined in:
- lib/rbbt/ner/rnorm/tokens.rb
Instance Method Summary collapse
-
#initialize ⇒ Transform
constructor
A new instance of Transform.
- #method_missing(name, *args, &block) ⇒ Object
- #transform(token) ⇒ Object
Constructor Details
#initialize ⇒ Transform
Returns a new instance of Transform.
103 104 |
# File 'lib/rbbt/ner/rnorm/tokens.rb', line 103 def initialize end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
105 106 107 108 109 110 111 112 113 |
# File 'lib/rbbt/ner/rnorm/tokens.rb', line 105 def method_missing(name, *args, &block) @token = name.to_sym if block_given? @block = block else @block = args.first end self end |
Instance Method Details
#transform(token) ⇒ Object
115 116 117 118 119 120 121 |
# File 'lib/rbbt/ner/rnorm/tokens.rb', line 115 def transform(token) if token[1] == @token token = @block.call(token[0]) else token end end |