Package miopia :: Package classifier :: Module ClassificationStrategy
[hide private]
[frames] | no frames]

Source Code for Module miopia.classifier.ClassificationStrategy

 1  ''' 
 2  Created on 29/01/2013 
 3   
 4  @author: David Vilares Calvo 
 5  ''' 
 6   
 7   
8 -class ClassificationStrategy(object):
9 ''' 10 classdocs 11 ''' 12 13
14 - def __init__(self,threshold):
15 ''' 16 Constructor 17 ''' 18 self._threshold = threshold
19 20
21 - def _type(self,sentiment_info):
22 raise NotImplementedError
23 24
25 - def polarity_info(self,info,**kwargs):
26 return self._type(info)
27 28
29 - def polarity(self,list_info,**kwargs):
30 """ 31 @param list_info: A list of tuples (textID,L{SentimentInfo}) 32 @return: A list of tuples (textID,L{PolarityType}) 33 """ 34 polarities = [] 35 for (f,sentiment_info) in list_info: 36 polarities.append((f, self.polarity_text(sentiment_info))) 37 return polarities
38