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

删除comment68.md

parent c985759f
No related branches found
No related tags found
No related merge requests found
```待评审函数开始protected void SentenceRun(String method) throws IOException
{
String text = getString("text");
int number = getInt("number", 6);
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 TextRankSummaryExtractor extractor = new TextRankSummaryExtractor(seg, new SentenceSeg());
extractor.setSentenceNum(number);
long s_time = System.nanoTime();
final List<String> sentence = extractor.getKeySentenceFromString(text);
double c_time = (System.nanoTime() - s_time)/1E9;
final Map<String, Object> map = new HashMap<>();
final DecimalFormat df = new DecimalFormat("0.00000");
//response the request
response(STATUS_OK, map);
}```待评审函数结束这是一个Java方法,用于处理一个请求,该请求需要从给定的文本中提取出指定数量的句子。方法首先获取文本和句子数量的参数,然后使用一个名为"extractor"的tokenizer实例进行分词和句子分割。然后,它使用TextRankSummaryExtractor从分词后的文本中提取关键句子,并计算提取时间。最后,它将提取结果封装到一个Map中并响应请求。
\ 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