Home | Trees | Indices | Help |
---|
|
1 ''' 2 Created on 16/05/2014 3 4 @author: David Vilares 5 ''' 6 7 from miopia.adapter.Feature import FeatureLevelBackOff 8 911 ''' 12 This class manages the generalisations (a.k.a as back-off) which make possible to represent tokens 13 as more abstract concepts. 14 ''' 15 16 NGRAM_BACK_OFF_DELIMITER = "-" 17 EMPTY_TOKEN = "EMPTY_TOKEN" 18 195121 ''' 22 @param dictionary: An instance of a L{Dictionary} 23 ''' 24 super(BackOff,self).__init__() 25 self._dictionary = dictionary26 2729 """ 30 @param token_info: A instance of a L{TokenInfo} 31 @param type_back_off: A valid value for L{FeatureLevelBackOff} 32 """ 33 34 if type_back_off == FeatureLevelBackOff.TYPE_BACK_OFF_COARSE_TAG: 35 return token_info.get_ctag() 36 if type_back_off == FeatureLevelBackOff.TYPE_BACK_OFF_FINE_TAG: 37 return token_info.get_ftag() 38 if type_back_off == FeatureLevelBackOff.TYPE_BACK_OFF_LEMMA: 39 return self._dictionary.get_lemma(token_info.get_ctag(), 40 token_info.get_form()).lower() 41 if type_back_off == FeatureLevelBackOff.TYPE_BACK_OFF_POLARITY_WORDS: 42 raise NotImplementedError 43 if type_back_off == FeatureLevelBackOff.TYPE_BACK_OFF_SEMANTIC_ORIENTATION: 44 raise NotImplementedError 45 if type_back_off == FeatureLevelBackOff.TYPE_BACK_OFF_WORD: 46 return token_info.get_form() 47 if type_back_off == FeatureLevelBackOff.TYPE_BACK_OFF_PSYCHOMETRIC: 48 return self._dictionary.get_psychometric_categories(token_info.get_form().lower()) 49 if type_back_off == FeatureLevelBackOff.TYPE_BACK_OFF_EMPTY: 50 return self.EMPTY_TOKEN
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Wed Oct 15 10:03:40 2014 | http://epydoc.sourceforge.net |