标签:app exce ring catch nbsp 分词 length smart exe
/** * * @param keyword 源词汇 * @param smart 是否智能分词 * @return 分词词组(,拼接) */ public static String getKeywords(String keyword, boolean smart) { StringReader reader = new StringReader(keyword); IKSegmenter iks = new IKSegmenter(reader, smart); StringBuilder buffer = new StringBuilder(); try { Lexeme lexeme; while ((lexeme = iks.next()) != null) { buffer.append(lexeme.getLexemeText()).append(‘,‘); } } catch (IOException e) { } //去除最后一个, if (buffer.length() > 0) { buffer.setLength(buffer.length() - 1); } return buffer.toString(); }
标签:app exce ring catch nbsp 分词 length smart exe
原文地址:https://www.cnblogs.com/pxblog/p/12146130.html