Guide to Developing on Windows

Once you've deployed the Salience distribution to your Windows system, the next step is to dig into the support provided for the development language of your choosing. The Salience distribution for Windows provides wrappers for integrating Salience functionality in .Net, 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 Windows, you should back-up to the documentation on installing Salience on Windows.


Getting Started with Salience in .Net on Windows

Integration of Salience into .Net applications consists of two layers. First, a set of .Net wrapper classes provided in the Salience6.NET.dll assembly. These provide the bridge between managed .Net code and the unmanaged Salience engine provided in Salience6.dll. When deploying Salience with your .Net applications both of these DLLs are required, as well as other third party support provided in c:\Program Files\Lexalytics\Salience\bin.

The Salience distribution for Windows includes a precompiled .Net wrapper which can be referenced directly in a .Net project to incorporate access to the wrapper classes which provide the access to Salience functionality. However, the distribution also includes the source code for the wrapper classes, and the following steps will walk you through building and running the examples provided.

1) Create a solution for the .Net example

Start Microsoft Visual Studio 2010, ensure that you "Run as administrator" because the example project exists within the Program Files folder.
Click Open Project and navigate to c:\Program Files\Lexalytics\Salience\SDK\dotNET\example, select ExampleDotNET.csproj.
Right-click the ExampleDotNET solution shown in the Solution Manager and select Add->Existing Project. Navigate to c:\Program Files\Lexalytics\Salience\SDK\dotNET\src, select Salience6.NET.csproj.
Build the ExampleDotNET solution. This will build both the Example console application and the .Net wrapper, copying Salience6.NET.dll into the console application's bin directory. Run the console application to step through the calls to Salience to process of a piece of sample content.
NOTE: The Salience installer adds the path to the Salience\bin directory to your PATH, which provides the runtime link needed for Salience6.dll.

2) Running the collection example

The portions of the sdk folder for other development languages contain separate code examples for document-level versus collection-level functionality, but the example project for .Net provides both.

Right-click the ExampleDotNET project shown in the Solution Manager and select Properties.
Change the Startup object from Lexalytics.Example to Lexalytics.CollectionExample.
Rebuild the ExampleDotNET solution. Run the console application to step through the calls to Salience to process of a hard-coded collection of sample content.

Back to top

Getting Started with Salience in Java on Windows

Java integration for Salience is comprised of two layers. First, a set of wrapper classes are provided in Salience\SDK\java\src\java\src, along with example Java code that utilize these wrapper classes. Additionally, precompiled JNI library is provided in the Salience\bin directory, java_salience.dll. This provides the bridge between Java and the underlying Salience Engine, Salience6.dll.

Based on the environment variables created during installation on Windows, your JVM should find the support needed at runtime. If not, you may need to copy java_salience.dll and Salience6.dll to your CLASSPATH.

It is also recommended that you add the path to the Salience\bin directory to your PATH environment variable to avoid UnsatisfiedLinkErrors.

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 Salience\SDK\java\src\java\src directory. The examples do need to be compiled into bytecode before they can be run.

> cd "C:\Program Files\Lexalytics\Salience\SDK\java\src\java\src"
> "C:\Program Files\Java\jdk-1.6.0_24\bin\javac.exe" SalienceExample.java
> java SalienceExample "C:\Program Files\Lexalytics\license.v5" 
       "C:\Program Files\Lexalytics\data" <path to text file>

Back to top

Getting Started with Salience in python on Windows

As with .Net and Java, the Salience distribution contains a precompiled wrapper for python, compiled for python 2.7. This precompiled wrapper can be found in Salience\bin\salience6.pyd. The source code for the python wrapper is also provided, and can be compiled for other versions of python if needed.

1) Deploying the precompiled python wrapper The precompiled python wrapper is found in the Salience\bin directory, named salience6.pyd. This should be copied into your python installation, usually c:\python27\DLLs.

2) Running the examples

The distribution contains two example python scripts, one which shows processing of a sample piece of content and the other which shows collection-level processing of a set of related content. These are found in the c:\Program Files\Lexalytics\Salience\sdk\python\example directory.

> python27.exe c:\program files\lexalytics\Salience\SDK\python\example\se6Python.py

3) If needed, building the python wrapper

Create a user environment variable PYTHON to provide the path to your python installation (eg. c:\python27).
Start Microsoft Visual Studio 2010, ensure that you "Run as administrator" because the wrapper source code exists within the Program Files folder.
Click Open Project and navigate to c:\Program Files\Lexalytics\Salience\SDK\python\src, select py_salience6.vcxproj.
Using the Configuration Manager, ensure that the Active solution configuration is Release, and the Active solution platform is x64.
Right-click the py_salience6 solution shown in the Solution Manager and select Properties to access project properties.
Select Configuration Properties->Linker->Input in the left pane. Add python27.lib (or appropriate .lib for your installed version of python).
Build the py_salience6 solution.
Copy the extension into your python environment:
> copy c:\program files\lexalytics\salience\sdk\python\x64\Release\salience6.pyd 
   c:\python27\DLLs
NOTE: The Salience installer adds the path to the Salience\bin directory to your PATH, which provides the runtime link needed for Salience6.dll. The wrapper simply provides a bridge between python code and the underlying Salience engine in Salience6.dll.

Back to top