Once you've deployed the Salience distribution to your Linux platform, the next step is to dig into the support provided for the development language of your choosing. The Salience distribution for Linux provides wrappers for integrating Salience functionality in Java and python.
Of course, you can always use the C API directly as well, in which case you'll be using the headers and libs provided, and should skip directly to the C API documentation.
If you have any questions about deployment on Linux, you should back up to the documentation on installing Salience on Linux.
Java integration for Salience is comprised of two layers. First, a set of wrapper classes are provided in
sdk/java/src/java/src, along with example Java code that utilize these wrapper classes. Additionally, precompiled JNI library is provided in the
libjava_salience.so. This provides the bridge between Java and the underlying Salience Engine,
Based on the environment variables recommended during installation on Linux, your JVM should find the support needed at runtime. If not, you may need to copy
Because a compiled JNI layer is provided in the distribution, the examples can be compiled and run without additional effort in setting up the integration for Java. These Java examples take command line arguments specifying the location to the license file, data directory and content file.
1) Run the examples
Example scripts to test document-level and collection-level functionality using the Java wrapper are provided in the
sdk/java/src/java/src directory. The examples do need to be compiled into bytecode before they can be run.
> cd $lxainstall/salience/sdk/java/src/java/src > javac SalienceExample.java > java SalienceExample $lxainstall/license.v5 $lxainstall/data <path to text file>
The source code for the python wrapper for Salience can be found within the SDK folder of the Linux distribution. The setup script provided compiles the source code into an extension module for python and distributes it to your python modules directory.
1) Build the wrapper
Navigate to the
sdk/python/src directory, and run the
setup.py script with the
> cd $lxainstall/salience/sdk/python/src > sudo python setup.py install
If you receive an error regarding missing python.h on Ubuntu/Debian, you may need to install python development support:
sudo apt-get install python-dev
For CentOS distributions the command is:
sudo yum install python-devel
If you receive the following error ImportError: //salience/lib/libstdc++.so.6: version 'GLIBCXX_3.4.9' not found (required by /usr/local/lib/python2.6/dist-packages/saliencefive.so), you must resolve the standard C library conflict. This is resolved by renaming the standard C library that is bundled with Salience:
> cd /<install dir>/salience/lib > mv libstdc++.so.6 __libstdc++.so.6
2) Run the example
Example scripts to test document-level and collection-level functionality using the python wrapper are provided in the
sdk/python directory. To run the example, you will need to provide the path to the license file, and the path to the data directory. You can optionally provide your own text file to analyze, if you omit this optional parameter, hard-coded example text will be analyzed.
> cd $lxainstall/salience/sdk/python > python se6Python.py $lxainstall/license.v5 $lxainstall/data/
Updated 7 months ago