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

lxaSetSalienceOption

Summary

Sets the value for an available option for the Salience Engine. Refer to Options documentation for the available options that may be set and their purpose.

Syntax

int lxaSetSalienceOption(SalienceSession* pSession, 
                         SalienceOption* pOption,
                         const char* acConfigurationID);

Parameters

pSession

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

pOption

Pointer to a SalienceOption structure containing option values to be set

acConfigurationID

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

Returns

This method returns an integer return code.

lxaDumpEnvironment

Summary

Provides output of options that have been set for the current Salience session and other environmental information. After use, you must use lxaFreeString to free memory allocated to the char* buffer.

Syntax

int lxaDumpEnvironment(SalienceSession* pSession, char** acEnvironment);

Parameters

pSession

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

acEnvironment

Pointer to a char* buffer which is filled with information about the Salience session environment

Returns

This method returns an integer return code.

Example

TODO: Example needed for Salience 6

lxaGetSalienceErrorString

Summary

Gets a human readable string describing the last error that occurred. This function sets the passed in char* to point to a null terminated string containing the error message. After use you should free the allocated memory by calling lxaFreeString.

Syntax

int lxaGetSalienceErrorString(SalienceSession* pSession, char** ppErrorString);

Parameters

pSession

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

ppErrorString

Pointer to a char* buffer

Returns

This method returns an integer return code.

Example

SalienceSession* pSession;
        char* acError;
        ...
        if (lxaOpenSalienceSession(oLicense,acDataPath,&pSession,&acError) == LXA_OK)
        {
            try  //Set it up so we throw if an error code is returned from a Salience call
            {
            ...
            }
            catch(...)
            {
                lxaGetSalienceErrorString(pSession,&acError);
                lxaFreeString(acError);
            }
            // Use the session
            lxaCloseSalienceSession(pSession);
        }

lxaGetLastWarnings

Summary

Gets the last warnings issued on a session. If you get a return of LXA_OK_WITH_WARNINGS on a function call then you can call this function to find out what the warnings were. The pWarnings pointer will be set to a bitmask containing the current warning codes.

Documentation of the warning codes can be found on the Errors and Warning Codes page.

Syntax

int lxaGetLastWarnings(SalienceSession* pSession, int* pWarnings);

Parameters

pSession

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

pWarnings

Pointer to an int that will take the warning bitmask

Returns

This method returns an integer return code.

Example

TODO: Example needed for Salience 6

lxaSetSalienceCallback

Summary

Sets a callback function that Salience can use to return messages during processing.

Syntax

int lxaSetSalienceCallback(SalienceSession* pSession, 
                           SalienceCallback oCallback, 
                           void* pParam);

Parameters

pSession

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

oCallback

A pointer to the callback function that you want to use. See below for the definition of this callback function

pParam

A pointer to a piece of data that you want to be passed into the callback function

Returns

This method returns an integer return code.

Comments

The format of the callback function is defined as

typedef int (*SalienceCallback)(void*,int,const char*);

so a real example might be:

int mycallback(void* pParam,int nCode,const char* acMessage) {
    printf(acMessage);
    printf("\n");
    return 0;
}

pParam will be set to what ever you set the pParam member of the lxaSetSalienceCallback call to be (useful for passing around a class). nCode and acMessage will both be set by the application to be the relevant error / message code and associated text string.

Example

char* acTagFile = "c:/sometags.dat";
        SalienceSession* pSession;
        ... //Set up the parameters as well as the license here
        if (lxaOpenSalienceSession(oLicense,acDataPath,&pSession,&acError) == LXA_OK)
        {
            lxaSetSalienceCallback(pSession,&mycallback,NULL);
            lxaSetTagDefinitions(pSession,acTagFile);
            ...
            lxaCloseSalienceSession(pSession);
        }

lxaSetSalienceOptionWithString

Summary

Sets one or more options via a specially formatted string. This is an alternative to lxaSetSalienceOption which requires you to programmatically define your option settings. You can also use lxaSetSalienceOptionsWithFile to load options from a file on disk. Refer to Options documentation for the available options that may be set and their purpose.

Syntax

int lxaSetSalienceOption(SalienceSession* pSession, 
                         const char* acOptionString,
                         const char* acConfigurationID);

Parameters

pSession

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

acOptionString

Character string that sets desired options.

acConfigurationID

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

Returns

This method returns an integer return code.

Option String Format

Each line in the string sets one option, and the format is "". The quotes around the option name are required. If the option value is a string that should be double quoted as well. The name of each option is available on the Options page.

Example Option String

"Tagging Threshold" 50
"Lists and Tables" 1
"User Entity List" "C:/Salience/user.dat"

lxaSetSalienceOptionsWithFile

Summary

Sets one or more options via a specially formatted file. This is an alternative to lxaSetSalienceOption which requires you to programmatically define your option settings. You can also use lxaSetSalienceOptionWithString to load options from an in memory string. Refer to Options documentation for the available options that may be set and their purpose.

Syntax

int lxaSetSalienceOption(SalienceSession* pSession, 
                         const char* acOptionString,
                         const char* acConfigurationID);

Parameters

pSession

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

acOptionString

Path to file that sets desired options.

acConfigurationID

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

Returns

This method returns an integer return code.

Option File Format

Each line in the file sets one option, and the format is "". The quotes around the option name are required. If the option value is a string that should be double quoted as well. The name of each option is available on the Options page.

Example Option String

"Tagging Threshold" 50
"Lists and Tables" 1
"User Entity List" "C:/Salience/user.dat"

Updated 7 months ago

Utility


Suggested Edits are limited on API Reference Pages

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