Salience

The Salience Developer Hub

Welcome to the Salience developer hub. You'll find comprehensive guides and documentation to help you start working with Salience as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Collection

lxaGetCollectionDetails

Summary

Retrieves information about the collection. At present, the SalienceCollectionDetails contains only the number of documents in the collection.

Syntax

int lxaGetCollectionDetails(SalienceSession *pSession, 
                            SalienceCollectionDetails *pDetails,
                            const char *acConfigurationID);

Parameters

pSession

Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession

pDetails

Pointer to aSalienceCollectionDetails structure that will get filled in by the call

acConfigurationID

Character string specifying the configuration for the results, blank for the default configuration

Returns

This function returns an integer return code.

Example

TODO: Provide example for Salience 6

lxaGetCollectionThemes

Summary

Retrieves the themes 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.

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 lxaGetCollectionThemes(SalienceSession *pSession,
                           SalienceThemeList *pResult,
                           const char *acConfigurationID);

Parameters

pSession

Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession

pResults

Pointer to a SalienceThemeList structure that will get filled in by the call

acConfigurationID

Character string specifying the configuration for the results, blank for the default configuration

Returns

This method returns an integer return code.

Example

TODO: Example needed for Salience 6

lxaGetCollectionFacets

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.

The acConfigurationID parameter specifies the configuration for the results, which are returned in a SalienceFacetList structure. Configurations are defined using the method lxaAddSalienceConfiguration.

After use you should free the allocated memory by calling lxaFreeFacetList.

Syntax

int lxaGetCollectionFacets(SalienceSession *pSession,
                           SalienceFacetList *pResults,
                           const char *acConfigurationID);

Parameters

pSession

Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession

pResults

Pointer to a SalienceFacetList structure that will get filled in by the call

acConfigurationID

Character string specifying the configuration for the results, blank for the default configuration

Returns

This method returns an integer return code.

Example

TODO: Example needed for Salience 6

lxaGetCollectionQueryDefinedTopics

Summary

Retrieves the topics determined for the collection 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 lxaGetCollectionQueryDefinedTopics(SalienceSession *pSession, 
                                       SalienceTopicList *pResult,
                                       const char *acConfigurationID);

Parameters

pSession

Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession

pResult

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.

lxaGetCollectionConceptDefinedTopics

Summary

Retrieves the entities from collection based on model-based or datafile-based entity extraction. Parameters to control entity extraction should be specified by setting Entity Options. Other adjustments can be made through the available Collection Options, which must be set before this call is made.

Sets the pEntities member of the passed in SalienceCollectionEntityList to point to an array of SalienceCollectionEntity structures. The nLength member is set to the length of this array.

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 lxaFreeCollectionEntityList.

Syntax

int lxaGetCollectionEntities(SalienceSession *pSession, 
                             SalienceCollectionEntityList *pResults,
                             const char *acConfigurationID);

Parameters

pSession

Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession

pResults

Pointer to a SalienceCollectionEntityList structure that will get filled in by the call

acConfigurationID

Character string specifying the configuration for the results, blank for the default configuration

Returns

LXA_OK

Entity extraction completed successfully.

LXA_OK_WITH_WARNINGS

There was a non-fatal issue with entity extraction. Use lxaGetLastWarnings to determine the cause of the warning.

Example

TODO: Example needed for Salience 6

lxaGetCollectionEntities

Summary

Retrieves the user-defined entities from the collection. This is based on the entity list specified through the User Entity List option. Other adjustments can be made through the available Collection Options, which must be set before this call is made.

Sets the pEntities member of the passed in SalienceCollectionEntityList to point to an array of SalienceCollectionEntity structures. The nLength member is set to the length of this array.

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 lxaFreeCollectionEntityList.

Syntax

int lxaGetCollectionUserEntities(SalienceSession *pSession, 
                                 SalienceCollectionEntityList *pResults,
                                 const char *acConfigurationID);

Parameters

pSession

Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession

pResults

Pointer to a SalienceCollectionEntityList structure that will get filled in by the call

acConfigurationID

Character string specifying the configuration for the results, blank for the default configuration

Returns

LXA_OK

Entity extraction completed successfully.

LXA_OK_WITH_WARNINGS

There was a non-fatal issue with entity extraction. Use lxaGetLastWarnings to determine the cause of the warning.

Example

TODO: Example needed for Salience 6

lxaGetCollectionUserEntities

Summary

Provides a structured representation of the document with annotation of entities identified within the text. The SalienceDocument structure contains a set of SalienceSentence structures, which contain SalienceWord structures that contain information about the entities within the document.

The acConfigurationID parameter specifies the configuration for the results. Configurations are defined using the method lxaAddSalienceConfiguration.

After use, you should free allocated memory by calling lxaFreeDocument.

Syntax

int lxaGetNamedEntityMarkup(SalienceSession *pSession,
                            SalienceDocument *pDocument,
                            const char *acConfigurationID);

Parameters

pSession

Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession

pDocument

Pointer to a SalienceDocument structure that will get filled in by the call

acConfigurationID

Character string specifying the configuration for the results, blank for the default configuration

Returns

This method returns an integer return code.

Example

std::string sMarkup = "";
         int nPrimaryId = -1;
         int nSecondaryId = -1;
         std::string sType = "";
    
         SalienceDocument oDocument;
         lxaGetNamedEntityMarkup(pSession,&oDocument);
    
         for(size_t i = 0; i < oDocument.nSentenceCount; i++)
         {
              for(size_t j = 0; j < oDocument.pSentences[i].nLength; j++)
              {
                   if(oDocument.pSentences[i].pTokens[j].nId == -1)
                   {
                        if(nPrimaryId != -1)
                        {
                             sMarkup += "</";
                             sMarkup += sType;
                             sMarkup += ">";
                             nPrimaryId = -1;
                             nSecondaryId = -1;
                        }
                        if(oDocument.pSentences[i].pTokens[j].nPostFixed == 0)
                        {
                             sMarkup += " ";
                        }
                        sMarkup += oDocument.pSentences[i].pTokens[j].acToken;
                   }
                   else
                   {
                        if(nPrimaryId == oDocument.pSentences[i].pTokens[j].nId && 
                           nSecondaryId == oDocument.pSentences[i].pTokens[j].nSecondaryId)
                        {
                             if(oDocument.pSentences[i].pTokens[j].nPostFixed == 0)
                             {
                                  sMarkup += " ";
                             }
                             sMarkup += oDocument.pSentences[i].pTokens[j].acToken;
                        }
                        else
                        {
                             if(nPrimaryId != -1)
                             {
                                  sMarkup += "</";
                                  sMarkup += sType;
                                  sMarkup += ">";
                             }
                             if(oDocument.pSentences[i].pTokens[j].nPostFixed == 0)
                             {
                                  sMarkup += " ";
                             }
                             nPrimaryId = oDocument.pSentences[i].pTokens[j].nId;
                             nSecondaryId = oDocument.pSentences[i].pTokens[j].nSecondaryId;
                             sType = oDocument.pSentences[i].pTokens[j].acEntityType;
                             sMarkup += "<";
                             sMarkup += sType;
                             sMarkup += ">";
                             sMarkup += oDocument.pSentences[i].pTokens[j].acToken;
                        }
                   }
              }
         }
         if(nPrimaryId != -1)
         {
              sMarkup += "</";
              sMarkup += sType;
              sMarkup += ">";
              nPrimaryId = -1;
              nSecondaryId = -1;
         }
    
         std::cout << sMarkup << std::endl;
         lxaFreeDocument(&oDocument);

Updated 7 months ago

Collection


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.