Package miopia :: Package adapter :: Module SentimentAdapter
[hide private]
[frames] | no frames]

Source Code for Module miopia.adapter.SentimentAdapter

 1  ''' 
 2  Created on 09/10/2013 
 3   
 4  @author: David Vilares 
 5  ''' 
 6   
 7   
 8  from miopia.adapter.SintacticAdapter import SintacticAdapter 
 9  from miopia.adapter.Feature import FeatureType 
10  from miopia.util.exceptions.FeatureTypeConfigurationException import FeatureTypeConfigurationException 
11  from miopia.analyzer.counter.SentimentCounter import SentimentCounter 
12   
13 -class SentimentAdapter(SintacticAdapter):
14 ''' 15 SentimentAdapter allows to obtain sentiment features from L{src.miope.analyzer.SentimentAnalyzer} 16 to then train a L{src.miope.classifier.ClassifierI} 17 ''' 18 19
20 - def __init__(self,path_weka, sentiment_counter):
21 ''' 22 @param path_weka: The path to the WEKA.jar 23 @param abstracted_lexicons_counter: An instance of L{SentimentCounter} 24 ''' 25 26 if not isinstance(sentiment_counter, SentimentCounter): 27 raise ValueError 28 29 super(SentimentAdapter,self).__init__(path_weka,sentiment_counter, 30 self.TOTAL_WEIGHTING_FACTOR) 31 print "Weight_factor",self._weighting_factor, self.TOTAL_WEIGHTING_FACTOR
32
33 - def _get_feature_type(self):
34 """ 35 @return: A string with the feature type provided by the SentimentAdapter 36 """ 37 return FeatureType.SENTIMENT_FEATURE
38