lxaGetQueryDefinedTopics

<< lxaGetThemes | Back to Salience 6 C API Index | lxaGetConceptDefinedTopics >>

Summary

Retrieves the topics determined for the text via user-defined queries. Before calling this method, you must specify the topic list using the Topic List option.
The acConfigurationID parameter specifies the configuration for the results, which are returned in a SalienceTopicList structure. Configurations are defined using the method lxaAddSalienceConfiguration.
After use you should free the allocated memory by calling lxaFreeTopicList.

Syntax

int lxaGetQueryDefinedTopics(SalienceSession *pSession, 
                             SalienceTopicList *pTopicList,
                             const char *acConfigurationID);

Parameters

pSession Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession
pTopicList Pointer to a SalienceTopicList structure
acConfigurationID Character string specifying the configuration for the results, blank for the default configuration

Returns

This function returns an integer return code.

Example

     SalienceOption oOption;
     oOption.nOption = SALIENCEOPTION_QUERYTOPICLIST;
     oOption.acValue = "/path/to/topic/list";
     lxaSetSalienceOption(pSession,&oOption);

     lxaPrepareTextFromFile(pSession,acPath);          
     SalienceTopicList oTopicList;
     lxaGetQueryDefinedTopics(pSession,&oTopicList);
     std::cout << "Query-Defined Topics: " << std::endl;

     for(int i = 0; i < oTopicList.nLength; i++)
     {
          std::cout << "Topic: " << oTopicList.pTopics[i].acTopic << std::endl;
          std::cout << "\tTopic Sentiment: " << oTopicList.pTopics[i].fSentiment << std::endl;
          std::cout << "\tHit(s): " << oTopicList.pTopics[i].nHits << "\n" << std::endl;
     }
     lxaFreeTopicList(&oTopicList);

<< lxaGetThemes | Back to Salience 6 C API Index | lxaGetConceptDefinedTopics >>