Package miopia :: Package analyzer :: Package counter :: Module Counter
[hide private]
[frames] | no frames]

Source Code for Module miopia.analyzer.counter.Counter

 1  ''' 
 2  Created on 13/05/2014 
 3   
 4  @author: David Vilares 
 5  ''' 
 6   
7 -class Counter(object):
8 ''' 9 Abstract class which provides the basic operations for the rest of the Counters. 10 ''' 11 12 BINARY = "BINARY" 13 TOTAL ="TOTAL" 14
15 - def __init__(self, ftc, weighting_factor = BINARY):
16 ''' 17 @param ftc: An instance of L{FeatureTypeConfiguration} 18 ''' 19 self._ftc = ftc
20 #self._weighting_factor = weighting_factor 21 22
24 return self._ftc
25
26 - def _id_of_feature(self, text_id, position ,name):
27 """ 28 Append to the name of the feature a value of a category of L{FeatureSemanticProperty} 29 @param str_name_feature: The basic name of the feature 30 @param value_semantic_property: A value of a category specified at L{FeatureSemanticProperty} 31 """ 32 #return name 33 return (text_id,position,name)
34 35 36
37 - def name_from_id(self,feature_id):
38 """ 39 @param feature_id: A tuple (textid, position,name) which identifies a feature in a file and in a graph. 40 @return The name of the feature. 41 """ 42 #TODO: This is duplicated in L{Adapter} 43 return feature_id[2]
44 45
46 - def file_id(self, feature_id):
47 """ 48 @param feature_id: A tuple (textid, position,name) which identifies a feature in a file and in a graph. 49 @return The file identifier where the current feature was found. 50 """ 51 return feature_id[0]
52 53
54 - def count(self,list_text_info):
55 """ 56 @param list_text_info: A list of L{TextInfo} objects 57 @return The collection of of features that were found in list_text_info 58 """ 59 return self._count(list_text_info)
60