From 14658c8b392f156dfcaa79bf451e17257b409c02 Mon Sep 17 00:00:00 2001 From: musteven <1009173794@qq.com> Date: Mon, 28 Apr 2025 12:40:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E5=81=9C=E7=94=A8=E8=AF=8D=E9=9B=86?= =?UTF-8?q?=E5=90=88=E5=AD=98=E6=94=BE=E5=9C=A8=E4=BA=86=E6=A0=B9=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=B8=8B=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=BA=86=E7=AE=97?= =?UTF-8?q?=E6=B3=95=E8=8E=B7=E5=8F=96=E5=81=9C=E7=94=A8=E8=AF=8D=E9=9B=86?= =?UTF-8?q?=E5=90=88=E7=9A=84=E5=AF=BB=E5=9D=80=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aes/problem/service/Impl/PlagiarismServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/AES/src/main/java/com/example/aes/problem/service/Impl/PlagiarismServiceImpl.java b/AES/src/main/java/com/example/aes/problem/service/Impl/PlagiarismServiceImpl.java index 9ffdc0a..71473f6 100644 --- a/AES/src/main/java/com/example/aes/problem/service/Impl/PlagiarismServiceImpl.java +++ b/AES/src/main/java/com/example/aes/problem/service/Impl/PlagiarismServiceImpl.java @@ -210,7 +210,10 @@ public class PlagiarismServiceImpl implements PlagiarismServiceI { private static final Set STOP_WORDS = new HashSet<>();//过滤停用词 static { try { - String stopwordsFilePath = "C:/Users/86186/Desktop/停用词.txt"; + // 获取项目根目录路径 + String projectRootDirectory = System.getProperty("user.dir"); + // 构建停用词文件的路径 + String stopwordsFilePath = projectRootDirectory + File.separator + "停用词.txt"; // 读取文件中的每一行 Files.readAllLines(Paths.get(stopwordsFilePath), StandardCharsets.UTF_8) .forEach(STOP_WORDS::add);