Package featuregenerator :: Package meteor :: Module meteor :: Class MeteorGenerator
[hide private]
[frames] | no frames]

Class MeteorGenerator

source code

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

Uses an existing JavaGateway (Py4j) in order to perform METEOR scoring and serve that as features. This Feature Generator overwrites the inherited get_features_tgt function for scoring target vs. the embedded reference translation of the ParallelSentence. See CrossMeteorGenerator for target cross-scoring.

Instance Methods [hide private]
 
__init__(self, lang, java_classpath, dir_path)
Constructor
source code
 
get_features_tgt(self, translation, 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
 
score(self, target, references) source code
{string: string}
score_sentence(self, target, references)
Score using the METEOR metric given one translated sentence, given a list of reference translations
source code
dict(score_name,score_value)
full_score_sentences(self, sentence_tuples)
Score many sentences using METEOR and return all basic scores.
source code
float
score_sentences(self, sentence_tuples)
Score many sentences using METEOR metrics and return a float for the many score
source code

Inherited from languagefeaturegenerator.LanguageFeatureGenerator: add_features_batch, add_features_batch_xml, add_features_dataset, get_features_simplesentence, get_features_src, get_features_string

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__

Class Variables [hide private]
  __name__ = 'Meteor'
Instance Variables [hide private]
py4j.java_gateway.JavaGateway gateway
An already initialized Py4j java gateway
str lang
the language abrev.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, lang, java_classpath, dir_path)
(Constructor)

source code 

Constructor

Parameters:
  • lang (string) - The language code for the proper initialization of this language-dependent tool
  • gateway (py4j.java_gateway.JavaGateway) - An already initialized Py4j java gateway
Overrides: object.__init__

get_features_tgt(self, translation, 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
(inherited documentation)

score_sentence(self, target, references)

source code 

Score using the METEOR metric given one translated sentence, given a list of reference translations

Parameters:
  • target (string) - The text of the (machine-generated) translation
  • references ([string, ...]) - A list of the reference translations, text-only
Returns: {string: string}
A dictionary of the various METEOR scoring results, namely precision, recall, fragPenalty and score

full_score_sentences(self, sentence_tuples)

source code 

Score many sentences using METEOR and return all basic scores.

Parameters:
  • sentence_tuples ([tuple(str(translation), [str(reference), ...]), ...]) - a list of tuples generated out of the translated sentences. Each tuple should contain one translated sentence and its list of references.
Returns: dict(score_name,score_value)
a dictionary containing METEOR scores, name and value

score_sentences(self, sentence_tuples)

source code 

Score many sentences using METEOR metrics and return a float for the many score

Parameters:
  • sentence_tuples ([tuple(str(translation), [str(reference), ...]), ...]) - a list of tuples generated out of the translated sentences. Each tuple should contain one translated sentence and its list of references.
Returns: float
the basic score float value