Class: Opener::SocialMediaClassifier
- Inherits:
-
Object
- Object
- Opener::SocialMediaClassifier
- Defined in:
- lib/opener/social_media_classifier.rb,
lib/opener/social_media_classifier/version.rb
Constant Summary collapse
- CORE_DIRECTORY =
Path to the directory containing all the Java source code.
File.('../../../core', __FILE__)
- TMP_DIRECTORY =
Path to the local tmp/ directory.
File.('../../../tmp', __FILE__)
- VERSION =
'1.0.0'
Instance Attribute Summary collapse
-
#input ⇒ Object
Returns the value of attribute input.
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
- #classify ⇒ Object
-
#initialize(input, output) ⇒ SocialMediaClassifier
constructor
input filename of the set that we want to be classified.
Constructor Details
#initialize(input, output) ⇒ SocialMediaClassifier
input filename of the set that we want to be classified. output filename. Full path or relative path (current directory.)
19 20 21 22 |
# File 'lib/opener/social_media_classifier.rb', line 19 def initialize(input, output) @input = input @output = output end |
Instance Attribute Details
#input ⇒ Object
Returns the value of attribute input.
6 7 8 |
# File 'lib/opener/social_media_classifier.rb', line 6 def input @input end |
#output ⇒ Object
Returns the value of attribute output.
6 7 8 |
# File 'lib/opener/social_media_classifier.rb', line 6 def output @output end |
Instance Method Details
#classify ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/opener/social_media_classifier.rb', line 24 def classify command1 = "sed -i '18s/.*/@attribute category? {0,1,2,3}/' #{input}" command2 = "java -classpath #{CORE_DIRECTORY}/target/weka.jar weka.filters.supervised.attribute.AddClassification -serialized #{TMP_DIRECTORY}/rf_liking.model -classification -remove-old-class -i #{input} -o #{output}.liking -c last" command3 = "sed -i '18s/.*/@attribute category? {0,1}/' #{input}" command4 = "java -classpath #{CORE_DIRECTORY}/target/weka.jar weka.filters.supervised.attribute.AddClassification -serialized #{TMP_DIRECTORY}/rf_recommendation.model -classification -remove-old-class -i #{input} -o #{output}.recommendation -c last" `#{command1}` `#{command2}` `#{command3}` `#{command4}` end |