Use ICTCLASJNI in Ubuntu

Source: Internet
Author: User
Download ictclas2011__32_jni, and unzip it to the ICTCLAS50_Linux_RHAS_32_JNI folder. Free

Download ictclas2011__32_jni, and unzip it to the ICTCLAS50_Linux_RHAS_32_JNI folder.

Free in http://linux.linuxidc.com/

The username and password are both www.linuxidc.com

Use ictclas jni in/pub/2011/08/04/Ubuntu/

Create a Java Project in Eclipse and put ICTCLAS under ICTCLAS50_Linux_RHAS_32_JNI/API to the src directory of the Java Project. Put all other content under ICTCLAS50_Linux_RHAS_32_JNI/API to the root directory of the Java Project, create a new java class named Test. In ICTCLAS50_Linux_RHAS_32_JNI/Doc, there is an ICTCLAS50 API usage instruction. Page 22nd is the first JNI sample program. Copy the content of this program to Test. java. Or directly use the following code:

Import ICTCLAS. i3S. AC. *; public class Test {public static void main (String [] args) {try {ICTCLAS50 testICTCLAS50 = new ICTCLAS50 (); // library required for word segmentation (that is, the Data folder) path String argu = ". "; // initialize if (testICTCLAS50.ICTCLAS _ Init (argu. getBytes ("GB2312") = false) {System. out. println ("Init Fail! "); Return;} else {System. out. println (" Init Succeed! ");} String sInput =" if you are interested in any content on this website, please contact us: Orisun@ymail.com. Republic of China "; byte nativeBytes [] = testICTCLAS50.ICTCLAS _ ParagraphProcess (sInput. getBytes ("GB2312"), 0, 0); // System. out. println (nativeBytes. length); String nativeStr = new String (nativeBytes, 0, nativeBytes. length, "GB2312"); // System. out. println ("The result is:" + nativeStr); String [] rest = nativeStr. split ("\ s +"); for (int I = 0; I
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.