Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Coding

Inhzus inhzus

🎯
Coding
View GitHub Profile
View HanLPSeg2Sentence.java
public static void main(String[] args) {
Segment segment = HanLP.newSegment().enableAllNamedEntityRecognize(false).enableCustomDictionary(false);
List<List<Term>> result = segment.seg2sentence("信里说他们离青云山还有很远,老祖宗说不着急,走个两三年也没什么打紧,所以他们走走停停," +
"有时听说哪里有好看好玩的事物,也会专门绕路过去,停驻几天。又说路上什么都好,哪怕是荒郊野外," +
"老祖宗也能变出热腾腾的吃食,还有各种衣物,穿戴比家里都要好。他们还自己动手搭过木屋,在一颗很高很大的树上," +
"建起了一座小小的屋子,为此他还专门学会了爬树…总之是一切都好,让父母大人不用担心他,老祖宗有个百宝囊,里面什么都有," +
"连书都有很多,没事的时候,他们就跟着老祖宗读书练字,最后祝高堂安泰。", true);
for (List<Term> sentence : result) {
for (Term term : sentence) {
System.out.printf("%s ", term.word);