getCollectionFacets

<< getCollectionThemes | Back to Salience 6 python Index | getCollectionQueryDefinedTopics >>

Summary

Retrieves the facets extracted across all documents in the collection. These results can be adjusted through the available Collection Options, which must be set before this call is made.
This method provides a wrapper around the underlying C API method lxaGetCollectionFacets.

Syntax

salience6.getCollectionFacets(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 of theme items containing the following information:
facet The text of the facet
total_hits The count of occurrences for the facet
positive_hits The number of occurrences which are associated with positive sentiment
negative_hits The number of occurrences which are associated with negative sentiment
neutral_hits The number of occurrences which are associated with neutral sentiment
mentions A list of tuples containing information about facet mentions
positive_mentions A list of tuples containing information about positive mentions of a facet, based on the value of the Neutral Upper Bound option.
negative_mentions A list of tuples containing information about negative mentions of a facet, based on the value of the Neutral Lower Bound option.'
neutral_mentions A list of tuples containing information about neutral mentions of a facet, based on the value of the Neutral Upper Bound and Neutral Lower Bound options.'
attributes A list of structures containing information about the attributes for the facet

Example

    import salience6 as se6
    session = se6.openSession('/path/to/license.v5','/path/to/data')
    ret = se6.prepareCollectionFromFile(session,'myCollection','/path/to/aFile.txt')
    if (ret==0):
        facets = se6.getCollectionFacets(session, "")
        for facet in facets:
            print facet["facet"], facet["total_hits"]
            for attribute in facet["attributes"]:
                print attribute["attribute"], len(attribute["mentions"])
    else:
        if (ret==6):
            print se6.getLastWarnings(session) 
    se6.closeSession(session)

<< getCollectionThemes | Back to Salience 6 python Index | getCollectionQueryDefinedTopics >>