prepareText

<< resetThemes | Back to Salience 6 python Index | prepareTextFromFile >>

Summary

Prepares a piece of text for processing. This function, or its sister function prepareTextFromFile, must be called every time you want to process a different piece of text. Text should either be 7bit ASCII or UTF8.
This method provides a wrapper around the underlying C API method lxaPrepareText.

Syntax

salience6.prepareText(oSession, sText)

Parameters

oSession A SalienceSession object previously created via openSession
sText A text string to be analyzed

Returns

Returns an integer return code. Possible error return codes are specified on the Errors and Warning Codes page.

Notes

Words that exceed 366 characters in length will be truncated. This is twice the length of the longest English word which is not a chemical compound.
Sentences that exceed 1000 words will cause the underlying call to lxaPrepareText to return with LXA_ERROR.

Example

    import salience6 as se6
    session = se6.openSession('/path/to/license.v5','/path/to/data')
    ret = se6.prepareText(session,'Lexalytics is based in Amherst, MA.')
    if (ret==0):
        ...extract results from text...
    else:
        if (ret==6):
            print se6.getLastWarnings(session) 
    se6.closeSession(session)

<< resetThemes | Back to Salience 6 python Index | prepareTextFromFile >>