Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
test-spring
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
倪 泽文
test-spring
Commits
92ec2a34
Commit
92ec2a34
authored
1 year ago
by
倪 泽文
Browse files
Options
Downloads
Patches
Plain Diff
来自大模型的评审
parent
ef26a3f9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
comment31.md
+52
-0
52 additions, 0 deletions
comment31.md
with
52 additions
and
0 deletions
comment31.md
0 → 100644
+
52
−
0
View file @
92ec2a34
```
待评审函数开始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;
}
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();
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);
}```待评审函数结束评分:8/10
优点:
* 对输入参数进行了有效性检查,防止了空指针异常和非法参数导致的错误。
* 使用了try-catch语句处理可能的IOException异常,提高了代码的健壮性。
* 对计算结果进行了格式化输出,提高了用户体验。
缺点:
* 对代码进行了多次重复的赋值和创建对象操作,可以考虑进行简化或者优化。
* 对关键变量的命名不够清晰,例如`autoMinLength`,建议更改为`minWordLength`。
* 对函数的注释不够详细,没有说明函数的作用和参数含义。
\ No newline at end of file
This diff is collapsed.
Click to expand it.
倪 泽文
@HongZe
mentioned in merge request
!69 (closed)
·
1 year ago
mentioned in merge request
!69 (closed)
mentioned in merge request !69
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment