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);