Class: RSemantic::MatrixTransformer
- Inherits:
-
Object
- Object
- RSemantic::MatrixTransformer
- Defined in:
- lib/rsemantic/matrix_transformer.rb
Instance Method Summary collapse
- #apply_transforms(vector_space_model) ⇒ Object
-
#initialize(transforms) ⇒ MatrixTransformer
constructor
A new instance of MatrixTransformer.
Constructor Details
#initialize(transforms) ⇒ MatrixTransformer
Returns a new instance of MatrixTransformer.
4 5 6 |
# File 'lib/rsemantic/matrix_transformer.rb', line 4 def initialize(transforms) @transforms = transforms end |
Instance Method Details
#apply_transforms(vector_space_model) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rsemantic/matrix_transformer.rb', line 8 def apply_transforms(vector_space_model) @transforms.each do |transform| begin transform_class = RSemantic::Transform.const_get(transform) RSemantic.logger.info("Applying #{transform} transform") transform_class.transform!(vector_space_model.matrix) RSemantic.logger.info(vector_space_model) rescue => e RSemantic.logger.error("Error: Cannot perform transform: #{transform}") RSemantic.logger.error(e) end end vector_space_model end |