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
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Pointer to a SalienceOption structure containing option values to be set |
| 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
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| 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
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| 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
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| 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
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| A pointer to the callback function that you want to use. See below for the definition of this callback function |
| 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
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Character string that sets desired options. |
| 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
| Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession |
---|---|
| Path to file that sets desired options. |
| 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 11 months ago