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


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.


salience6.getQueryDefinedTopics(oSession, acConfigurationID)


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


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)


    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"]
        if (ret==6):
            print se6.getLastWarnings(session) 

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