===========
Use TinySVM
===========
This page describes a procedure that enables `TinySVM `_ to be used with RaSC. TinySVM must be changed at the program level to perform input and output through file (for the changes, refer to ref:`faq_modify_program`).
The following describes a procedure to change the program by applying a patch to it so that TinySVM may be used as an RaSC service.
Change TinySVM to be RaSC-enabled
=================================
First, get the TinySVM source code.
.. code-block:: bash
$ wget http://chasen.org/~taku/software/TinySVM/src/TinySVM-0.09.tar.gz
$ tar zxvf TinySVM-0.09.tar.gz
Then, get the patch file.
.. code-block:: bash
$ wget https://alaginrc.nict.go.jp/rasc/resources/patch_rasc_TinySVM.diff
Then, apply the patch.
.. code-block:: bash
$ patch -p0 < patch_rasc_TinySVM.diff
Then, build.
.. code-block:: bash
$ cd TinySVM-0.09
$ ./configure
$ make
These commands produce the executable binary svm_classify, which has been modified so that it can be used with RaSC.
Configure service XML for TinySVM
=================================
In a service definition XML, describe a start command line that includes the path to and the model file of the executable binary (you can download the :download:`service XML `).Modify ___BASE_DIR___ and ___PATH_TO_MODEL_FILE___ to the directory that actually includes svm_classify and the path to the model file.
.. code-block:: xml
:emphasize-lines: 8-10
- For ``cmdLine``, set the path to TinySVM that was created before by applying the patch, ``-V`` as the option for verbosity, ``-`` that indicates that standard input may be accepted as an input, and finally specify the model file.
- For ``delimiterIn``, describe ``\n[END_OF_INPUT]\n`` because the patch has been applied to set the input delimiting character string to ``[END_OF_INPUT]``.
- Similarly, for delimiterOut, describe ``EOS\n`` because the patch has been applied to set the output delimiting character string to ``EOS\n``.
- Within the program, ``\n`` in this example will be replaced with an appropriate linefeed code suitable for each system.
For information on the procedure to start the service, refer to :doc:`rasc_core` or :doc:`rasc_basic`.