Package featuregenerator :: Module languagefeaturegenerator :: Class LanguageFeatureGenerator
[hide private]
[frames] | no frames]

Class LanguageFeatureGenerator

source code

                       object --+    
                                |    
featuregenerator.FeatureGenerator --+
                                    |
                                   LanguageFeatureGenerator
Known Subclasses:

Extends the base FeatureGenerator class, by providing basic checking/functioning for language-specific feature processes. This way, this class can be inhereted and extended for feature categories that can only correspond to a particular language specified upon the initialization of the object

Instance Methods [hide private]
 
__init__(self, lang)
In order to initialize a language-specific feature generator, the language needs to be instantiatied as a class variable
source code
list(sentence.parallelsentence.ParallelSentence)
add_features_batch(self, parallelsentences)
Abstract method to be overriden by the particular subclassed feature generator.
source code
 
add_features_batch_xml(self, filename_in, filename_out) source code
 
add_features_dataset(self, dataset)
Augments the provided DataSet with features of the current feature generator.
source code
 
get_features_simplesentence(self, simplesentence, parallelsentence)
Abstract method to be overriden by the particular subclassed feature generator.
source code
 
get_features_src(self, simplesentence, parallelsentence)
Function that falls back to the general simple sentence feature generation, only if the language is supported by the feature generator It receives a source simple sentence and returns a list of source features.
source code
 
get_features_string(self, string) source code
 
get_features_tgt(self, simplesentence, parallelsentence)
Function that falls back to the general simple sentence feature generation, only if the language is supported by the feature generator It receives a target simple sentence and returns a list of target features.
source code

Inherited from featuregenerator.FeatureGenerator: add_features_parallelsentence, add_features_simplesentence, add_features_src, add_features_tgt, get_annotation_name, get_features_parallelsentence, process_dataset

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
str lang
the language abrev.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, lang)
(Constructor)

source code 

In order to initialize a language-specific feature generator, the language needs to be instantiatied as a class variable

Parameters:
  • lang (string) - the language code of the language that the feature generator is capable of
Overrides: object.__init__

add_features_batch(self, parallelsentences)

source code 

Abstract method to be overriden by the particular subclassed feature generator. It allows the generation of features over many parallelsentences. It is a flexible solution when feature generation doesn't take place item to item (see SAX parsing) but a whole list of parallel sentences needs to be implemented at once. In this case, feature generator may optimize better when the whole dataset is given.

Parameters:
  • parallelsentences (list(sentence.parallelsentence.ParallelSentence)) - The parallel sentences to be be augmented
Returns: list(sentence.parallelsentence.ParallelSentence)
The given list of ParallelSentence which are now augmented with features generated from the current featuregenerator
Overrides: featuregenerator.FeatureGenerator.add_features_batch

add_features_dataset(self, dataset)

source code 

Augments the provided DataSet with features of the current feature generator. 
    It fires feature generation over the included parallelsentences it is composed of.
    It is not compatible with SAX parsing.
@param dataset: The DataSet whose contents will be augmented
@type dataset: sentence.dataset.DataSet
@rtype: sentence.dataset.DataSet
@return: The given DataSet augmented with features generated from the current featuregenerator 

Overrides: featuregenerator.FeatureGenerator.add_features_dataset

get_features_simplesentence(self, simplesentence, parallelsentence)

source code 

Abstract method to be overriden by the particular subclassed feature generator. It receives a simple sentence of any type and returns a list of features. It should be overriden by a feature generator that doesn't differentiate between source and target features

Overrides: featuregenerator.FeatureGenerator.get_features_simplesentence

get_features_src(self, simplesentence, parallelsentence)

source code 

Function that falls back to the general simple sentence feature generation, only if the language is supported by the feature generator It receives a source simple sentence and returns a list of source features.

Overrides: featuregenerator.FeatureGenerator.get_features_src

get_features_string(self, string)

source code 
Overrides: featuregenerator.FeatureGenerator.get_features_string

get_features_tgt(self, simplesentence, parallelsentence)

source code 

Function that falls back to the general simple sentence feature generation, only if the language is supported by the feature generator It receives a target simple sentence and returns a list of target features.

Overrides: featuregenerator.FeatureGenerator.get_features_tgt

Instance Variable Details [hide private]

lang

the language abrev. code
Type:
str