This page describes a procedure that enables SVM Perf classifier (svm_perf_classify) to be used with RaSC.
SVM Perf must be changed at a program level to perform input and output through file (the changes are described with CRF++ as an example in How can I modify existing user programs to run them on RaSC?). The following describes a procedure to change the program by applying a patch to it so that SVM Perf may be used as an RaSC service.
First, get the SVM Perf source code.
$ wget http://download.joachims.org/svm_perf/current/svm_perf.tar.gz
$ mkdir svm_perf
$ tar zxvf svm_perf.tar.gz -C svm_perf
Create new files necessary to apply a patch.
$ touch svm_perf/svm_light/svm_classify_stdin.c
$ touch svm_perf/svm_struct/svm_struct_classify_stdin.c
Then, get the patch file.
$ wget https://alaginrc.nict.go.jp/rasc/resources/patch_rasc_svm_perf.diff
Then, apply the patch.
$ patch -p0 < patch_rasc_svm_perf.diff
Then, build SVM Perf.
$ cd svm_perf
$ ./configure
$ make
These commands produce the executable binary svm_perf_classify_stdin, which has been modified so that it can be used with RaSC.
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 service XML).Modify ___SVM_PERF_DIR___ and ___PATH_TO_MODEL_FILE___ to the directory that actually includes svm_perf_classify_stdin and the path to the model file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="target"
class="jp.go.nict.langrid.servicecontainer.handler.TargetServiceFactory">
<property name="service">
<bean class="jp.go.nict.wisdom.wrapper.StdIOCommandService">
<property name="cmdLine" value="___SVM_PERF_DIR___/svm_perf_classify_stdin ___PATH_TO_MODEL_FILE___" />
<property name="delimiterIn" value="\n[END_OF_INPUT]\n" />
<property name="delimiterOut" value="EOS\n" />
<property name="delLastNewline" value="true" />
</bean>
</property>
</bean>
</beans>
For information on the procedure to start the service, refer to Run a user program as a RaSC service or Work with various network protocols.