forked from hankcs/HanLP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayGround.java
More file actions
52 lines (46 loc) · 1.33 KB
/
PlayGround.java
File metadata and controls
52 lines (46 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* <summary></summary>
* <author>He Han</author>
* <email>hankcs.cn@gmail.com</email>
* <create-date>2014/9/8 12:55</create-date>
*
* <copyright file="TestPlayGround.java" company="上海林原信息科技有限公司">
* Copyright (c) 2003-2014, 上海林原信息科技有限公司. All Right Reserved, http://www.linrunsoft.com/
* This source is subject to the LinrunSpace License. Please contact 上海林原信息科技有限公司 to get more information.
* </copyright>
*/
package com.hankcs.test.seg;
import com.hankcs.hanlp.seg.common.Term;
import com.hankcs.hanlp.seg.NShort.NShortSegment;
import junit.framework.TestCase;
import java.util.List;
import java.util.Scanner;
/**
* @author hankcs
*/
public class PlayGround extends TestCase
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
String line;
while ((line = scanner.nextLine()).length() > 0
)
{
seg(line);
}
}
private static void seg(String sentence)
{
List<Term> terms = NShortSegment.parse(sentence);
for (Term wr : terms)
{
System.out.print(wr.word + wr.nature);
}
System.out.println();
}
public void testCharSequence() throws Exception
{
CharSequence s = "hello";
}
}