CAS calling code word, no speech tagging

package test;


import java.io.File;


import ICTCLAS.I3S.AC.ICTCLAS50;
public  class fenci{
public void callICTCLAS(String inTxtPath, String outTxtPath) {
/*
* This class implements calls ICTCLAS Chinese word segmentation, and save the results in a separate txt file
* Author: Guo Xiyue
* Time: 2013-7-20

* */
// Specify word of the source and target files
String sourceTxt = inTxtPath;
String targetTxt = outTxtPath;
try {
// Create instance word
ICTCLAS50 testICTCLAS50 = new ICTCLAS50();
// word required library path
String argu = new File("").getAbsolutePath();
// set the character encoding
testICTCLAS50.ICTCLAS_Init(argu.getBytes("UTF-8"));
// Set the user vocabulary path
int nCount = 0;
// String usrdir = "D: /projectFiles/userDict/userdict.txt"; // user dictionary path
// converted from the user dictionary to byte string type
// byte[] usrdirb = usrdir.getBytes();
// Import user dictionary, the user returns the number of words in the first import parameter to a user dictionary path, the second parameter is a user dictionary coding type
// nCount = testICTCLAS50.ICTCLAS_ImportUserDictFile(usrdirb, 0);
// parameter conversion
String s1 = "d:/1.txt";
String s2 = "d:/2.txt";
// segment words
testICTCLAS50.ICTCLAS_FileProcess(s1.getBytes(), 0, 0,
s2.getBytes());
// exit program word
testICTCLAS50.ICTCLAS_Exit ();
// jLabel2.setText ( "document word success");
System.out.print("11");
} catch (Exception e) {
System.out.print("22");

// jLabel2.setText ( "word document failed");
}
}
public static void main(String[] args)
{
fenci s1=new fenci();
String s = null,s2 = null;
s1.callICTCLAS(s, s2 ) ;




}}



Published 12 original articles · won praise 6 · views 20000 +

Guess you like

Origin blog.csdn.net/huaweizte123/article/details/16950019