Brief introduction
Support Word breaker mode
Search mode for user-queried word segmentation
Index mode, used for Word segmentation on indexed documents
Characteristics
Supports multiple word-breaker modes
Full angle uniform turn into half angle
User dictionary Features
Conf directory has organized Sogou cell thesaurus
For performance reasons, the latest snapshot version removes part-of-speech tagging and wants a better pull request to provide that functionality.
Simple to use
Get Jieba-analysis
<Dependency> <groupId>Com.huaban</groupId> <Artifactid>Jieba-analysis</Artifactid> <version>1.0.2</version></Dependency>
Case
@Test Public void Testdemo () { new jiebasegmenter (); = new string[] {"This is a pitch night." My name is Monkey king, I love Beijing, I love Python and C + +. "I don't like Japanese kimonos." "," the Thunder Monkey returned to Earth. ", " The work Letter Virgo officer every month through subordinate departments have to tell the 24 switch and other technical device installation work ", the result of marriage and not married"}; for (String sentence:sentences) { System.out.println (segmenter.process (sentence, segmode.index). toString ()) ; }}
Original link: https://github.com/huaban/jieba-analysis
My app
Packagecom.analysis;ImportJava.io.BufferedReader;ImportJava.io.InputStreamReader;Importjava.sql.Connection;ImportJava.sql.DriverManager;Importjava.sql.PreparedStatement;ImportJava.sql.ResultSet;Importjava.util.List;ImportJava.util.UUID;ImportOrg.junit.Before;Importorg.junit.Test;ImportCom.huaban.analysis.jieba.JiebaSegmenter;ImportCom.huaban.analysis.jieba.JiebaSegmenter.SegMode;ImportCom.huaban.analysis.jieba.SegToken; Public classJiebatest {PrivateConnection con =NULL; PrivatePreparedStatement pstmt =NULL; /*** Connection*/@Before Public voidBeforedemo ()throwsException {class.forname ("Com.mysql.jdbc.Driver"); String URL= "Jdbc:mysql://localhost:3306/test?user=root&password=root"; Con=drivermanager.getconnection (URL); } /*** Word segmentation query Test*/@Test Public voidGetdemo ()throwsException {bufferedreader br=NewBufferedReader (NewInputStreamReader (system.in)); String Str=Br.readline (); String SQL= "SELECT * from T_jieba where name =?"; Pstmt=con.preparestatement (SQL); Pstmt.setstring (1, str); ResultSet RS=Pstmt.executequery (); while(Rs.next ()) {System.out.println (Rs.getint (1) + "--" +rs.getstring (2) + "--" +rs.getstring (3) + "--" +rs.getstring (4) + "--" +rs.getstring (5)); Pstmt.clearparameters (); String SQL1= "Update t_jieba set times =?" WHERE id =? "; Pstmt=con.preparestatement (SQL1); Pstmt.setint (1, 1+NewInteger (Rs.getstring (5))); Pstmt.setint (2, Rs.getint (1)); Pstmt.executeupdate (); } rs.close (); Pstmt.close (); } /*** participle insertion test*/@Test Public voidAdddemo ()throwsException {String SQL= "INSERT into T_jieba (name,cid,c_name,times) Select?,?,?,? From DUAL where isn't EXISTS (select name from T_jieba where name=?) "; Pstmt=con.preparestatement (SQL); Jiebasegmenter Segmenter=NewJiebasegmenter (); string[] sentences=NewString[] {"Big talk data Structure", "in-depth design mode", "The Subversion of Java EE Development: Spring boot Combat", "Java from getting started to giving up" }; for(String sentence:sentences) {//System.out.println (segmenter.process (sentence, segmode.index). toString ());String uuid =Uuid.randomuuid (). toString (); UUID= Uuid.replace ("-", "" "); List<SegToken> list =segmenter.process (sentence, segmode.index); for(Segtoken segtoken:list) {String name=SegToken.word.trim (); if(Name! =NULL&& "". Equals (name)) {pstmt.setstring (1, Segtoken.word); Pstmt.setstring (2, UUID); Pstmt.setstring (3, sentence); Pstmt.setstring (4, "0"); Pstmt.setstring (5, Segtoken.word); Pstmt.executeupdate (); Pstmt.clearparameters (); }}} pstmt.close (); System.out.println ("Insert success!" "); }}
Mydemo
Jieba participle/jieba-analysis (Java edition)