赞
踩
dependencies {
implementation 'com.hankcs:hanlp:portable-1.7.8'
}
String text = "请帮我找出和nujNplaib有关的衣服";
List<Term> termList = HanLP.segment(text);
for (Term keyword : termList) {
Log.d("fxHou分词","---------------------------------------------------------");
Log.d("fxHou词语",keyword.word);
Log.d("fxHou词性",keyword.nature.toString());
}
List<String> keywordList = HanLP.extractKeyword(text, 5);
for (String keyword : keywordList) {
Log.d("fxHou关键词","---------------------------------------------------------");
Log.d("fxHou关键词",keyword);
}
2022-09-09 21:04:13.887 20673-20673 fxHou分词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.887 20673-20673 fxHou词语 com.example.hanlptest D 请 2022-09-09 21:04:13.887 20673-20673 fxHou词性 com.example.hanlptest D v 2022-09-09 21:04:13.888 20673-20673 fxHou分词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.888 20673-20673 fxHou词语 com.example.hanlptest D 帮 2022-09-09 21:04:13.888 20673-20673 fxHou词性 com.example.hanlptest D v 2022-09-09 21:04:13.888 20673-20673 fxHou分词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.888 20673-20673 fxHou词语 com.example.hanlptest D 我 2022-09-09 21:04:13.888 20673-20673 fxHou词性 com.example.hanlptest D r 2022-09-09 21:04:13.888 20673-20673 fxHou分词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.888 20673-20673 fxHou词语 com.example.hanlptest D 找出 2022-09-09 21:04:13.888 20673-20673 fxHou词性 com.example.hanlptest D v 2022-09-09 21:04:13.888 20673-20673 fxHou分词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.888 20673-20673 fxHou词语 com.example.hanlptest D 和 2022-09-09 21:04:13.888 20673-20673 fxHou词性 com.example.hanlptest D c 2022-09-09 21:04:13.888 20673-20673 fxHou分词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.888 20673-20673 fxHou词语 com.example.hanlptest D nujNplaib 2022-09-09 21:04:13.888 20673-20673 fxHou词性 com.example.hanlptest D nx 2022-09-09 21:04:13.888 20673-20673 fxHou分词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.888 20673-20673 fxHou词语 com.example.hanlptest D 有关 2022-09-09 21:04:13.888 20673-20673 fxHou词性 com.example.hanlptest D vn 2022-09-09 21:04:13.888 20673-20673 fxHou分词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.888 20673-20673 fxHou词语 com.example.hanlptest D 的 2022-09-09 21:04:13.888 20673-20673 fxHou词性 com.example.hanlptest D uj 2022-09-09 21:04:13.888 20673-20673 fxHou分词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.888 20673-20673 fxHou词语 com.example.hanlptest D 衣服 2022-09-09 21:04:13.888 20673-20673 fxHou词性 com.example.hanlptest D n 2022-09-09 21:04:13.904 20673-20673 fxHou关键词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.904 20673-20673 fxHou关键词 com.example.hanlptest D 请 2022-09-09 21:04:13.904 20673-20673 fxHou关键词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.904 20673-20673 fxHou关键词 com.example.hanlptest D 衣服 2022-09-09 21:04:13.904 20673-20673 fxHou关键词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.904 20673-20673 fxHou关键词 com.example.hanlptest D 帮 2022-09-09 21:04:13.904 20673-20673 fxHou关键词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.904 20673-20673 fxHou关键词 com.example.hanlptest D nujNplaib 2022-09-09 21:04:13.904 20673-20673 fxHou关键词 com.example.hanlptest D --------------------------------------------------------- 2022-09-09 21:04:13.904 20673-20673 fxHou关键词 com.example.hanlptest D 找出
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。