Paoding Cook looked through participle use small example (study note)

Source: Internet
Author: User

Recommended use for note-taking (Wiz), it is a computer, mobile phone, tablet can be used by cloud notebook software, using my invitation to register to receive VIP Experience: http://www.wiz.cn/i/02c6808b


Do SRT encounter to participle, before made a word breaker system, but that is the teacher provides the thesaurus, really want to do their own participle, meici library how line.

Looking for a thesaurus everywhere, can not find easy to use, but also in Taiwan, some academic institutions to see a thesaurus, but to NT $10,000 ocean, depressed ~ ~

No way, the last thought of directly find open source software, find Cook looked through, so big call "cool".

The following direct to a small example, the function is to read the contents of a TXT file in a directory and Word, the word segmentation results display:

First of all, configure the paoding operating environment, nothing more than the cook looked through with the jar files imported into the project.

Then you need to import the package:

Import Java.io.BufferedReader;
Import Java.io.BufferedWriter;
Import Java.io.File;
Import Java.io.FileInputStream;
Import java.io.FileNotFoundException;
Import Java.io.FileWriter;
Import java.io.IOException;
Import Java.io.InputStreamReader;

Import Net.paoding.analysis.analyzer.PaodingAnalyzer;

Import Org.apache.lucene.analysis.Analyzer;
Import Org.apache.lucene.analysis.Token;
Import Org.apache.lucene.analysis.TokenStream;
Import Org.eclipse.swt.SWT;
Import Org.eclipse.swt.events.SelectionAdapter;
Import org.eclipse.swt.events.SelectionEvent;
Import Org.eclipse.swt.widgets.Button;
Import Org.eclipse.swt.widgets.Display;
Import Org.eclipse.swt.widgets.Label;
Import Org.eclipse.swt.widgets.Menu;
Import Org.eclipse.swt.widgets.MenuItem;
Import Org.eclipse.swt.widgets.Shell;
Import Org.eclipse.swt.widgets.Text;
This is copied directly from my project, some of which are not available.


Write your own test class below and paste the following code in:

public static void Main (string[] args) throws IOException {

		String content = null;

		The cook looked through is encapsulated into the Analyzer Specification Analyzer
		Analyzer = new Paodinganalyzer () that meets the requirements of Lucene;

		FileInputStream in = null;
		in = new FileInputStream (New File ("D://text.txt"));

		InputStreamReader Inreader = new InputStreamReader (in);
		BufferedReader br = new BufferedReader (inreader);
		Tokenstream ts = analyzer.tokenstream (content, BR);

		Token T;
		t = Ts.next ();
		while (t! = null) {
			content + = T.termtext () + "";
			System.out.println (T.termtext ());
			t = Ts.next ();
		}
	}

Create a Text.txt file in the D-Packing directory and post the first two paragraphs of this article.


Test the console output:

March 06, 2012 1:22:50 pm Net.paoding.analysis.knife.PaodingMaker getProperties
Information: config paoding analysis from:f:\eclipse_work\srtdemo\file:\f:\eclipse_work\srtdemo\lib\paoding-analysis.jar!\ Paoding-analysis.properties; F:\eclipse_work\srtdemo\file:\f:\eclipse_work\srtdemo\lib\paoding-analysis.jar!\ Paoding-analysis-default.properties; F:\eclipse_work\srtdemo\file:\f:\eclipse_work\srtdemo\lib\paoding-analysis.jar!\paoding-analyzer.properties; F:\eclipse_work\srtdemo\bin\paoding-dic-home.properties;d:\dic\paoding-dic-names.properties; F:\eclipse_work\srtdemo\file:\f:\eclipse_work\srtdemo\lib\paoding-analysis.jar!\paoding-knives.properties; F:\eclipse_work\srtdemo\file:\f:\eclipse_work\srtdemo\lib\paoding-analysis.jar!\paoding-knives-user.properties
March 06, 2012 1:22:50 pm Net.paoding.analysis.knife.PaodingMaker createpaodingwithknives
Info: Add Knike:net.paoding.analysis.knife.CJKKnife
March 06, 2012 1:22:50 pm Net.paoding.analysis.knife.PaodingMaker createpaodingwithknives
Info: Add Knike:net.paoding.analysis.knife.LetterKnife
March 06, 2012 1:22:50 pm Net.paoding.analysis.knife.PaodingMaker createpaodingwithknives
Info: Add Knike:net.paoding.analysis.knife.NumberKnife
Do
Srt
Met
To
Word segmentation
Ago
before
Did a
One
Word segmentation
System
That one
Teacher
Provide
Word Library
Really want to
Do
Word segmentation
Meici
Word Library
How
Yes
Everywhere
Find a Word
Word Library
Less than
I can't find them.
Good
Use the
Later
Still in
In Taiwan
Taiwan
A
Academic
Institutions
See
One
A word
Word Library
But to
Nt $
10000
Big
Big
Ocean
Depressed
Not done
Way
At last
Think
Direct
Find
Open source
Word segmentation
Software
Found it
Cook looked through
So
Big
Big call
Cool



Must be successful.

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.