Package featuregenerator :: Package iq :: Module acrolinxclient :: Class IQFeatureGenerator
[hide private]
[frames] | no frames]

Class IQFeatureGenerator

source code

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

Handles communication with an Acrolinx IQ server

Instance Methods [hide private]
 
__init__(self, lang, settings={}, user_id='dfkitaraxu', host='msv-3231.sb.dfki.de:8031', wsdl_path='/acrolinx/services/core-no-mtom?wsdl', protocol='http', license_file='license.dat')
In order to initialize a language-specific feature generator, the language needs to be instantiatied as a class variable
source code
 
_get_property(self, response, key)
Performs a search into the response of the server, and returns the value of a SOAPproperty given its key
source code
str
_update_license(self, response)
Function to call every time we get a response that may change the license.
source code
{str: str}
_read_report_url(self, report_url)
Processes the xml report by Acrolinx IQ and returns a dict of the corrections suggested
source code
[SoapProperty, ...]
_attributes2soapproperties(self, attributes={})
Converts a normal python dict to a list of SoapProperty instances
source code
 
_initialize_session(self) source code
 
_start_new_check(self) source code
{str: str}
get_features_string(self, text)
Receives a text and returns a dict with numerical quality observation features
source code
 
get_language_options(self) source code
 
__del__(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_tgt

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]
  host
str lang
the language abrev.
  license_data
@ivar
  user_id
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, lang, settings={}, user_id='dfkitaraxu', host='msv-3231.sb.dfki.de:8031', wsdl_path='/acrolinx/services/core-no-mtom?wsdl', protocol='http', license_file='license.dat')
(Constructor)

source code 

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

Parameters:
  • lang (str) - abrev. code for the language that this generator will be responsible for
  • host (str) - the hostname (and the port) of the SOAP server
  • wsdl_path (str) - the wsdl path of the MTOM service, that needs to be appended to the end of the request url
  • protocol (str) - the protocol, default value http
Overrides: object.__init__

_get_property(self, response, key)

source code 

Performs a search into the response of the server, and returns the value of a SOAPproperty given its key

Parameters:
  • response

_update_license(self, response)

source code 

Function to call every time we get a response that may change the license. It extracts the license string from the response and updates the text file. Then it returns the license string. This should be called after registerUser or checkDocument

Returns: str
the license string

_read_report_url(self, report_url)

source code 

Processes the xml report by Acrolinx IQ and returns a dict of the corrections suggested

Parameters:
  • report_xml (str) - the content of the report
Returns: {str: str}
a dict containing the correction suggested

To Do: write the function that reads the XML

_attributes2soapproperties(self, attributes={})

source code 

Converts a normal python dict to a list of SoapProperty instances

Parameters:
  • attrib, utes - a dict containing soap properties
  • attributes ({str, str})
Returns: [SoapProperty, ...]
a list of SoapProperty instances that can be sent to Soap

To Do: replace the handwritten soapProperties with

get_features_string(self, text)

source code 

Receives a text and returns a dict with numerical quality observation features

Parameters:
  • text (str) - text to be evaluated
Returns: {str: str}
a dict with attributes retrieved from the quality analysis
Overrides: featuregenerator.FeatureGenerator.get_features_string