getNamedEntityRelationships

<< getUserEntities | Back to Salience 6 python Index | getNamedEntityOpinions >>

Summary

Gets the relationships between named entities within the text.
This method provides a wrapper around the underlying C API method lxaGetNamedEntityRelationships.

Syntax

salience6.getNamedEntityRelationships(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:
entities A list of the entities that are related, with mention information about each entity
type Type of relationship as defined in the relationship pattern files (Occupation, etc.)
confidence A measure of confidence in the relationship detection for the entities
extra A placeholder for an extra information that can be detected about the relationship

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):
        relations = se6.getNamedEntityRelationships(session, "")
        for relation in relations:
            print relation["type"], 
                  relation["entities"][0]["normalized_form"],
                  relation["entities"][1]["normalized_form"]
    else:
        if (ret==6):
            print se6.getLastWarnings(session) 
    se6.closeSession(session)

<< getUserEntities | Back to Salience 6 python Index | getNamedEntityOpinions >>