Package featuregenerator :: Module hjerson :: Class Hjerson
[hide private]
[frames] | no frames]

Class Hjerson

source code

                                   object --+        
                                            |        
            featuregenerator.FeatureGenerator --+    
                                                |    
languagefeaturegenerator.LanguageFeatureGenerator --+
                                                    |
                                                   Hjerson

This is a class that wraps the Hjerson functionality on a sentence level.

Instance Methods [hide private]
 
__init__(self, **kwargs)
By initializing Hjerson, we maintain a tokenizer (if needed) and a treetager object so that they are available for sentence-level calls
source code
{str: object, ... }
get_features_tgt(self, simplesentence, parallelsentence)
Override language feature generator function in order to return sentence level error classes
source code
 
_tag(self, string) source code
 
get_features_strings(self, target_string, references)
Process one sentence, given the translated sentence (hypothesis) and the corresponding reference
source code
 
analyze(self, hline, basehline, addhline, refs, baserefs, addrefs)
This functions hosts the core sentence-level functionality of Hjerson, as written originally by Maja Popovic.
source code
 
calculate_total_scores(self) 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__

Instance Variables [hide private]

Inherited from languagefeaturegenerator.LanguageFeatureGenerator: lang

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **kwargs)
(Constructor)

source code 

By initializing Hjerson, we maintain a tokenizer (if needed) and a treetager object so that they are available for sentence-level calls

Parameters:
  • tokenize (boolean) - specify if tokenizer should be run by Hjerson, false if it has already happened
  • lang (str) - specify which language is the content using the language 2-letter iso code
  • tagdir (str) - specify the directory where the treetager bin folder exists
Overrides: object.__init__

get_features_tgt(self, simplesentence, parallelsentence)

source code 

Override language feature generator function in order to return sentence level error classes

Parameters:
Returns: {str: object, ... }
a dictionary with the attributes retrieved
Overrides: featuregenerator.FeatureGenerator.get_features_tgt

get_features_strings(self, target_string, references)

source code 

Process one sentence, given the translated sentence (hypothesis) and the corresponding reference

Parameters:
  • target_string (str) - the translation hypothesis produced by the system
  • references (list(str)) - a list of strings, containing the correct translations

analyze(self, hline, basehline, addhline, refs, baserefs, addrefs)

source code 

This functions hosts the core sentence-level functionality of Hjerson, as written originally by Maja Popovic. It operates after all sentence-level strings have been retrieved and passed as parameters

Parameters:
  • hline