*-----------------------------------------------------------------------------------------------*
* A framework for multitask sequence labeling dedicated for natural language processing tasks.  *
*                                                                                               *
* Authors: Michał Marcińczuk (2010–2014) (coordinator),                                         *
*          Michał Krautforst (2013-2014), Jan Kocoń (2014)                                      *
*          Dominik Piasecki (2013), Maciej Janicki (2011)                                       *
* Contact: michal.marcinczuk@pwr.wroc.pl                                                        *
*                                                                                               *
*          G4.19 Research Group, Wrocław University of Technology                               *
*-----------------------------------------------------------------------------------------------*
    
Liner2 package requires CRF++ (http://crfpp.googlecode.com/svn/trunk/doc/index.html).
The compatible version can be also found in the ./external folder.

-----------------------------
Step 1: Installation of CRF++
-----------------------------

If you have already installed CRF++ go to step 2. If not, then continue this step.

CRF++ requires gcc and g++ to compile. Make sure you have installed the required packages.

Go to lib/ folder and unpack CRF++-0.57.tar.gz

  tar -xvf CRF++-0.57.tar.gz
  
Go inside CRF++-0.57 folder, compile and install the library:

  cd CRF++-0.57
  ./configure
  make
  sudo make install
  sudo ldconfig


-----------------------------
Step 2: Create Java binding
-----------------------------

Java binding requires java-jdk to compile.

Navigate to lib/CRF++-0.57 (or your local copy of CRF++) and execute:

  cd java
  make

At this step you might encounter a problem with finding jni.h file. You have to
check a path to the java-sdk — the INCLUDE parameter in 'external/crfpp/java/Makefile'. 

Make sure that the files 'lib/libCRFPP.so' and 'lib/CRFPP.jar' were created.

Copy the above files to liner2/lib folder.

-----------------------------
Step 3: Compile liner2
-----------------------------

The Ant Apache tool is required to build liner2.jar package.

Execute the following command:

  ant jar
 

-----------------------------
Step 4: Test
-----------------------------
  
To check, if the configuration was successful run the following command (the package with models can
be downloaded from http://nlp.pwr.wroc.pl/liner2 web page):

  ./liner2-cli pipe -m liner24-model-n82/config-n82.ini -i ccl -f resources/sample-sentence.xml -o tuples
  
You should see the following output:

  (4,11,nam_liv_person,"Ala Nowak")
  (20,28,nam_loc_gpe_city,"Warszawie")
  
  
-----------------------------
Step 5: Install liner2-cli command
-----------------------------

You can create a global command 'liner2' referring to the local copy of liner2 by executing:

  sudo ant install
  
Then you can run liner2 from any location:  
  
  liner2-cli pipe -m liner24-model-n82/config-n82.ini -i ccl -f test/sentence.xml -o tuples

You can also set a default model by placing the -ini parameter in the liner2/local.ini file.
The path to the model must be absolute, for example:

  -m /nlp/tools/liner24-model-n82/config-n82.ini
