prepareCollectionFromList

<< addSectionFromFile | Back to Salience 6 python Index | prepareCollectionFromFile >>

Summary

Prepares the contents of a list for processing. This function, or its sister function prepareCollectionFromFile, must be called every time you want to process a different set of related pieces of text. The list must consist of individual strings that are either 7bit ASCII or UTF8.
This method provides a wrapper around the underlying C API method lxaPrepareCollection.

Syntax

salience6.prepareCollectionFromList(oSession, sName, lstContent)

Parameters

oSession A SalienceSession object previously created via openSession
sName A descriptive name for the collection
lstContent A list of text strings to process as a collection of related content

Returns

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

Example

    import salience6 as se6
    session = se6.openSession('/path/to/license.v5','/path/to/data')
    # Prepare the collection
    content = []
    content.append("The cruise was excellent and service was great.")
    content.append("I found the temperature in the dining rooms very cold.")
    ...
    ret = se6.prepareCollectionFromList(session, 'myCollection', content)
    if (ret==0):
        ...extract results from text...
    else:
        if (ret==6):
            print se6.getLastWarnings(session)     
    se6.closeSession(session)

<< addSectionFromFile | Back to Salience 6 python Index | prepareCollectionFromFile >>