prepareTextFromFile

<< prepareText | Back to Salience 6 python Index | addSection >>

Summary

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

Syntax

salience6.prepareTextFromFile(oSession, sFile)

Parameters

oSession A SalienceSession object previously created via openSession
sFile Fully-qualified path to a readable text file

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 lxaPrepareTextFromFile to return with LXA_ERROR.

Example

    import salience6 as se6
    session = se6.openSession('/path/to/license.v5','/path/to/data')
    ret = se6.prepareTextFromFile(session,'/path/to/aFile.txt')
    if (ret==0):
        ...extract results from text...
    else:
        if (ret==6):
            print se6.getLastWarnings(session) 
    se6.closeSession(session)

<< prepareText | Back to Salience 6 python Index | addSection >>