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

来自大模型的评审

parent ba1049ff
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);
}```
待评审函数结束
This is a Java method that takes in a string parameter "method" and an integer parameter "number" with a default value of 6. The method uses the JcsegGlobalResource class to obtain a tokenizer instance called "extractor" and a segment object called "seg". The method then creates an instance of TextRankSummaryExtractor, which uses the given segment object and sentence segmentation algorithm to extract the most important sentences from the given text. The number of sentences to be extracted is determined by the "number" parameter, which has a default value of 6. The method also calculates the time taken to execute the extraction process and stores the result in a map. Finally, the method returns a response indicating the success of the process.
\ No newline at end of file
  • 倪 泽文 @HongZe

    mentioned in merge request !75

    ·

    mentioned in merge request !75

    Toggle commit list
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