lxaGetDocumentDetails
Summary
Retrieves various bits of useful information about the current text including term frequency analysis and document chunk information.
The acConfigurationID
parameter specifies the configuration for the results, which are returned in a SalienceDocumentDetails structure. Configurations are defined using the method lxaAddSalienceConfiguration.
Call lxaFreeDocumentDetails when you are finished with the information to free any allocated memory.
Syntax
int lxaGetDocumentDetails(SalienceSession *pSession,
SalienceDocumentDetails *pDetails,
const char *acConfigurationID);
Parameters
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Pointer to a SalienceDocumentDetails structure |
| Character string specifying the configuration for the results, blank for the default configuration |
Returns
This function returns an integer return code.
Example
char* acBuffer = "This is some text to process";
...
SalienceSession* pSession;
SalienceDocumentDetails oDetails;
if(lxaOpenSalienceSession(oLicense, &oStartup, &pSession) != LXA_OK)
return 1;
lxaPrepareText(pSession,acBuffer);
lxaGetDocumentDetails(pSession,&oDetails);
...
lxaFreeDocumentDetails(&oDetails);
lxaCloseSalienceSession(pSession);
lxaGetSummary
Summary
Retrieves summary information for the current text. The SalienceSummaryResult structure provides a default summary and an alternate summary, as well as ranking for the sentences in the summary.
The default summary method determines the most significant fragments in the document, and extracts the first sentence from those fragments. The alternate method extracts sentences that connect the most fragments.
The acConfigurationID
parameter specifies the configuration for the results, which are returned in a SalienceSummaryResult structure. Configurations are defined using the method lxaAddSalienceConfiguration.
After use you should free the result structure using lxaFreeSummaryResult.
Syntax
int lxaGetSummary(SalienceSession *pSession,
int nLength,
SalienceSummaryResult *pResult,
const char *acConfigurationID);
Parameters
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Length, in number of sentences, of the summary you want returned |
| Pointer to a SalienceSummaryResult structure |
| Character string specifying the configuration for the results, blank for the default configuration |
Returns
This function returns an integer return code.
Example
char* acPath = "/path/to/content";
SalienceSummaryResult oSummary;
...
SalienceSession* pSession;
if(lxaOpenSalienceSession(oLicense, &oStartup, &pSession) != LXA_OK)
return 1;
lxaPrepareTextFromFile(pSession,acPath);
lxaGetSummary(pSession,4,&oSummary);
std::cout << "Summary: " << oSummary.acSummary << std::endl;
std::cout << "Alternate summary: " << oSummary.acAlternateSummary << std::endl;
lxaFreeSummaryResult(oSummary);
lxaCloseSalienceSession(pSession);
lxaGetSentiment
Summary
Retrieves sentiment analysis of the document text. This consists of results for phrase-based and model-based sentiment analysis.
The acConfigurationID
parameter specifies the configuration for the results, which are returned in a SalienceSentimentResult structure. Configurations are defined using the method lxaAddSalienceConfiguration.
Call lxaFreeSentimentResult when you are finished with the information to free any allocated memory.
Syntax
int lxaGetSentiment(SalienceSession *pSession,
int nUseChains,
SalienceSentimentResult *pResult,
const char *acConfigurationID);
Parameters
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Determines if chains are used to calculate sentiment |
| Pointer to a SalienceSentimentResult structure |
| Character string specifying the configuration for the results, blank for the default configuration |
Returns
This function returns an integer return code.
Comments
TODO: Insert explanation when to set nUseChains to 0 or 1
Example
char* acPath = "/path/to/content";
...
SalienceSession* pSession;
if(lxaOpenSalienceSession(oLicense, &oStartup, &pSession) != LXA_OK)
return 1;
lxaPrepareTextFromFile(pSession,acPath);
SalienceSentimentResult oResult;
lxaGetSentiment(pSession,1,&oResult);
//Phrase-based sentiment results
std::cout << "Document Sentiment: " << oResult.fScore << std::endl;
SalienceSentimentPhraseList sspList = oResult.oPhrases;
for(int i = 0; i < sspList.nLength; i++)
{
std::cout << "oPhrase: " << sspList.pPhrases->oPhrase.acText << std::endl;
std::cout << "oSupportingPhrase: " << sspList.pPhrases->oSupportingPhrase.acText;
}
//Model-based sentiment results
SalienceSentimentModel* ssm = oResult.pModel;
std::cout << "Model:\t" << ssm->acModelName << std::endl;
std::cout << "Best:\t" << ssm->nBest << std::endl;
std::cout << "Pos:\t" << ssm->fPositive << std::endl;
std::cout << "Neg:\t" << ssm->fNegative << std::endl;
std::cout << "Mixed:\t" << ssm->fMixed << std::endl;
std::cout << "Count:\t" << oResult.nModelCount << std::endl;
lxaFreeSentimentResult(&oResult);
lxaCloseSalienceSession(pSession);
lxaGetThemes
Summary
Retrieves the document-level themes of the text.
The acConfigurationID
parameter specifies the configuration for the results, which are returned in a SalienceThemeList structure. Configurations are defined using the method lxaAddSalienceConfiguration.
After use you should free the allocated memory by calling lxaFreeThemeList.
Syntax
int lxaGetThemes(SalienceSession *pSession,
SalienceThemeList *pResults,
const char *acConfigurationID);
Parameters
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|
Returns
This function returns an integer return code.
Example
char* acPath = "/path/to/content";
...
SalienceSession* pSession;
if(lxaOpenSalienceSession(oLicense, &oStartup, &pSession) != LXA_OK)
return 1;
lxaPrepareTextFromFile(pSession,acPath);
SalienceThemeList oThemeList;
lxaGetThemes(pSession,&oThemeList);
for(int i = 0; i < oThemeList.nLength; i++)
{
...
}
lxaFreeTopicList(&oTopicList);
lxaCloseSalienceSession(pSession);
lxaGetQueryDefinedTopics
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
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Pointer to a SalienceTopicList structure |
| 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);
lxaGetConceptDefinedTopics
Summary
Retrieves the topics determined for the text via the Salience 6 Concept Matrix. Before calling this method, you must specify a concept topic list using the Concept 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 lxaGetConceptDefinedTopics(SalienceSession *pSession,
SalienceTopicList *pTopicList,
const char *acConfigurationID);
Parameters
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Pointer to a SalienceTopicList structure |
| 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_CONCEPTTOPICLIST;
oOption.acValue = "/path/to/concept/topic/list";
lxaSetSalienceOption(pSession,&oOption);
lxaPrepareTextFromFile(pSession,acPath);
SalienceTopicList oTopicList;
lxaGetConceptDefinedTopics(pSession,&oTopicList);
std::cout << "Concept 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);
lxaExplainConceptMatches
Summary
Retrieves the topics determined for the text via the Salience 6 Concept Matrix, as well as terms from the content that generated the match. Before calling this method, you must specify a concept topic list using the Concept Topic List option.
This method has a longer execution time than the call to lxaGetConceptDefinedTopics and should be reserved for use in diagnostic or research interfaces or other application areas where a longer execution time is feasible.
The acConfigurationID
parameter specifies the configuration for the results, which are returned via a pointer to a character buffer. Configurations are defined using the method lxaAddSalienceConfiguration.
After use you should free the allocated memory by calling lxaFreeString.
Syntax
int lxaExplainConceptMatches(SalienceSession *pSession,
char **ppBuffer,
const char *acConfigurationID);
Parameters
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Pointer to a character buffer containing a concept matches and a list of terms with match scores |
| 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_CONCEPTTOPICLIST;
oOption.acValue = "/path/to/concept/topic/list";
lxaSetSalienceOption(pSession,&oOption);
char* acConceptMatches;
lxaPrepareTextFromFile(pSession,acPath);
lxaExplainConceptMatches(pSession,&acConceptMatches);
std::cout << "Concept Topics: " << std::endl;
std::cout << acConceptMatches << std::endl;
lxaFreeString(&acConceptMatches);
lxaGetDocumentCategories
Summary
Retrieves the categories for a document based on a predefined taxonomy, which can be tuned through additional data files.
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 lxaGetDocumentCategories(SalienceSession *pSession,
SalienceTopicList *pTopicList,
const char *acConfigurationID);
Parameters
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Pointer to a SalienceTopicList structure |
| Character string specifying the configuration for the results, blank for the default configuration |
Returns
This function returns an integer return code.
Example
lxaPrepareTextFromFile(pSession,acPath);
SalienceTopicList oCategories;
lxaGetDocumentCategories(pSession,&oCategories);
std::cout << "Document Categories: " << std::endl;
for(int i = 0; i < oCategories.nLength; i++)
{
std::cout << "Category: " << oCategories.pTopics[i].acTopic << std::endl;
}
lxaFreeTopicList(&oCategories);
lxaGetDocumentClasses
Summary
Retrieves the classifications for a document based on the provided classification model. The classification model is set using the ClassificationModel 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 lxaGetDocumentClasses(SalienceSession *pSession,
SalienceTopicList *pResult,
const char *acConfigurationID);
Parameters
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Pointer to a SalienceTopicList structure |
| Character string specifying the configuration for the results, blank for the default configuration |
Returns
This function returns an integer return code.
lxaGetIntentions
Summary
Retrieves the intentions expressed within the document content. Intentions are returned as a list of SalienceIntention structures.
The acConfigurationID
parameter specifies the configuration for the results. Configurations are defined using the method lxaAddSalienceConfiguration.
After use you should free the allocated memory by calling lxaFreeIntentionList.
Syntax
int lxaGetIntentions(SalienceSession *pSession,
SalienceIntentionList *pResults,
const char *acConfigurationID);
Parameters
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Pointer to a SalienceIntentionList structure |
| Character string specifying the configuration for the results, blank for the default configuration |
Returns
This function returns an integer return code.
Example
lxaPrepareTextFromFile(pSession,acPath);
SalienceIntentionList oIntentions;
lxaGetIntentions(pSession,&oIntentions);
std::cout << "Intentions: " << std::endl;
for(int i = 0; i < oIntentions.nLength; i++)
{
std::cout << "Intention: " << oIntentions.pResults[i].acType << "\t"
<< oIntentions.pResults[i].acEvidence << std::endl;
}
lxaFreeIntentionList(&oIntentions);
Updated 12 months ago