Embed the Chinese Emy of Sciences word segmentation software ictclas50 into the Java Web project developed by struts2

Source: Internet
Author: User

Ictclas50 is a very common word segmentation tool in NLP. It is very simple to embed it into Java programs. There are also relevant tutorials on the Internet. Due to the development needs, I tried to deploy ictclas50 to the Java Web developed based on struts2. The results encountered problems, but there were not many materials available for reference on the Internet. After unremitting efforts, the final solution is summarized as follows.

Premise: use an independently installed Tomcat for debugging. This is not necessary. If you want to, you can use Tomcat that comes with myeclipse for debugging. Because I used an independently installed Tomcat for debugging, I only said how I did it.

1. Download ictclas50 from the Internet. It is usually a compressed package. After decompression, there should be four folders. What we need is the API folder.

2. Copy all files except the ICTCLAS folder in the API folder to the bin folder in the tomcat installation directory.

3. Use the ICTCLAS folder in the API folder as a package and load it to the SRC of your project (you can copy and paste it in myeclipse to automatically change it to a package)

4. Return to the decompressed ictclas50 folder and you will see a sample folder. This is an example. You can refer to testmain. java program, write your own program in your project.


In fact, this is basically done here, But I encountered a problem in this step. I directly wrote the code that calls the ICTCLAS program to the action execute () method, but it cannot run. Later, I wrote a main method in the class and found that this class program can run completely normally. Think twice. So I later thought of another way to put the program that calls ICTCLAS into a Java file separately, and then write another class corresponding to the action in its execute () to call the separately stored class, and then the wood is ready. It's always normal!

Oh, I almost forgot. There was an episode in the middle. I configured ictclas in the independently installed tomcat, but in myeclipse, I called the built-in Tomcat for debugging, the result is always the init fail prompt, and the problem was discovered only later at the prompt of the students. I am a newbie, so I still need to be careful!

Related Article

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.