我使用ictclas4j取词返回的是:"兰州/ns 的/u 交通/n 怎么样/r ?/w "
请问如何把这个字符串里的词add到list里(把\ns \u \n撒的都不要)?
结果是list.1=兰州 list.2=的 list.3=交通 list.4=交通 list.5=怎么样 list.6=?我的取词代码是
public static void main(String[] args) { SegTag segTag = new SegTag(1); SegResult sr = segTag.split("兰州的交通怎么样?"); System.out.println(sr.getFinalResult()); }
请问如何把这个字符串里的词add到list里(把\ns \u \n撒的都不要)?
结果是list.1=兰州 list.2=的 list.3=交通 list.4=交通 list.5=怎么样 list.6=?我的取词代码是
public static void main(String[] args) { SegTag segTag = new SegTag(1); SegResult sr = segTag.split("兰州的交通怎么样?"); System.out.println(sr.getFinalResult()); }
Pattern p = Pattern.compile("");
Matcher m = p.matcher(str);
String[] s= str.split("/[a-z]+");
for(int i=0;i<s.length;i++)
System.out.print(s[i]);
Matcher m = p.matcher(str);
这些没用,不要
ArrayList<String> al = new ArrayList<String>();
System.out.print(Arrays.asList(s));