Skip to content
Snippets Groups Projects
Commit b82cfcb1 authored by 倪 泽文's avatar 倪 泽文
Browse files

删除comment18.md

parent 3b19fb46
No related branches found
No related tags found
No related merge requests found
```待评审函数开始protected void keyPraseRun(String method) throws IOException
{
String text = getString("");
int number = getInt("number", 10),
maxCombineLength = getInt("maxCombineLength", 4),
autoMinLength = getInt("autoMinLength", 4);
if ( text == null || "".equals(text) ) {
response(STATUS, "Invalid Arguments");
return;
}
if ( text == null || "".equals(text) ) {
response(STATUS, "Invalid Arguments");
return;
}
final JcsegGlobalResource resourcePool = (JcsegGlobalResource)globalResource;
final JcsegTokenizerEntry tokenizerEntry = resourcePool.getTokenizerEntry("extractor");
if ( tokenizerEntry == null ) {
response(STATUS_INVALID_ARGS, "can't find tokenizer instance \"extractor\"");
return;
}
final ISegment seg = ISegment.COMPLEX.factory.create(tokenizerEntry.getConfig(), tokenizerEntry.getDict());
final TextRankKeyphraseExtractor extractor = new TextRankKeyphraseExtractor(seg);
extractor.setKeywordsNum(number);
extractor.setMaxWordsNum(maxCombineLength);
extractor.setAutoMinLength();
long s_time = System.nanoTime();
final List<String> keyphrase = extractor.getKeyphraseFromString(text);
double c_time = (System.nanoTime() - s_time)/1E9;
final Map<String, Object> map = new HashMap<>();
DecimalFormat df = new DecimalFormat("0.00000");
map.put("took", Float.valueOf(df.format(c_time)));
//response the request
response(0, map);
}```待评审函数结束这个函数看起来是一个使用TextRank算法生成关键词的Java函数。它接受四个参数:文本字符串、关键词数量、最大关键词组合长度和自动最小长度。然后,它创建一个TextRankKeyphraseExtractor对象,并设置关键词数量、最大关键词组合长度和自动最小长度。然后,它使用这个对象从文本字符串中提取关键词,并计算生成关键词所需的时间。最后,它将生成的关键词和所需时间作为JSON对象返回。
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment