大量后端代码格式化

This commit is contained in:
SunCheng
2026-01-18 22:04:56 +08:00
parent 298ce03aa6
commit 4e2bf0da6c
36 changed files with 278 additions and 200 deletions

View File

@@ -1,8 +1,7 @@
namespace Service;
using JiebaNet.Analyser;
using JiebaNet.Segmenter;
using JiebaNet.Analyser;
using Microsoft.Extensions.Logging;
namespace Service;
/// <summary>
/// 文本分词服务接口
@@ -78,7 +77,7 @@ public class TextSegmentService : ITextSegmentService
{
if (string.IsNullOrWhiteSpace(text))
{
return new List<string>();
return [];
}
try
@@ -119,7 +118,7 @@ public class TextSegmentService : ITextSegmentService
{
_logger.LogError(ex, "提取关键词失败,文本: {Text}", text);
// 降级处理:返回原文
return new List<string> { text.Length > 10 ? text.Substring(0, 10) : text };
return [text.Length > 10 ? text.Substring(0, 10) : text];
}
}
@@ -127,7 +126,7 @@ public class TextSegmentService : ITextSegmentService
{
if (string.IsNullOrWhiteSpace(text))
{
return new List<string>();
return [];
}
try
@@ -146,7 +145,7 @@ public class TextSegmentService : ITextSegmentService
catch (Exception ex)
{
_logger.LogError(ex, "分词失败,文本: {Text}", text);
return new List<string> { text };
return [text];
}
}
}