getQueryDefinedTopics

<< getDocumentThemes | Back to Salience 6 python Index | getConceptDefinedTopics >>

Summary

Returns the topics determined for the text via user-defined queries. Before calling this method, you must specify the topic list using the Query Topic List option.
This method provides a wrapper around the underlying C API method lxaGetQueryDefinedTopics.

Syntax

salience6.getQueryDefinedTopics(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 consisting of items that contain the following information about a topic:
topic The label for the topic
hits The number of query terms from the query definition which occur within the document
score 0 (not used)
sentiment The sentiment score for document content associated with the topic
summary Summary related to query hits
type 0 (indicates query topic result)

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_QueryTopicList(session, '/path/to/queries.txt')
        topics = se6.getQueryDefinedTopics(session, "")
        for topic in topics:
            print topic["topic"], topic["hits"], topic["score"]
    else:
        if (ret==6):
            print se6.getLastWarnings(session) 
    se6.closeSession(session)

<< getDocumentThemes | Back to Salience 6 python Index | getConceptDefinedTopics >>