getUserEntities

<< getNamedEntities | Back to Salience 6 python Index | getNamedEntityRelationships >>

Summary

Returns the user-defined entities from text. This is based on the entity list specified through the User Entity List option. Other parameters to control entity extraction should be specified by setting additional Entity Options. These options must be set before calling this method.
This method provides a wrapper around the underlying C API method lxaGetUserDefinedEntities.

Syntax

salience6.getUserEntities(oSession, acConfigurationID)

Parameters

oSession A SalienceSession object previously created via openSession
acConfigurationID An identifier for a configuration added through addConfiguration, or empty string for default configuration

Returns

If successful, returns a Python list containing with the following items:
normalized_form Normalized form of the entity
type Type of entity (Company, Person, Place, Product, etc.)
label Descriptive label for the entity
score Sentiment score for the entity
evidence A measure of how much evidence the sentiment score was based on (1 to 7)
confident Whether the entity passed any confidence queries
about Whether the document is about this entity
summary A summary of the document related to this entity
mentions A list of objects providing mention information for the entity
themes A list of objects providing theme information for the entity

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):
        se6.setOption_UserEntityList(session, '/path/to/list.cdl')
        entities = se6.getUserEntities(session, "")
        for entity in entities:
            print entity["normalized_form"], entity["type"]
    else:
        if (ret==6):
            print se6.getLastWarnings(session) 
    se6.closeSession(session)

<< getNamedEntities | Back to Salience 6 python Index | getNamedEntityRelationships >>