From 4233cfc79292af651e36d8c55dd142d95452cc2a Mon Sep 17 00:00:00 2001 From: fly6516 Date: Wed, 16 Apr 2025 09:44:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(3-1):=20=E6=9B=B4=E6=96=B0=20stopwords.txt?= =?UTF-8?q?=20=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 HDFS 文件路径从相对路径改为绝对路径 - 新路径为 "hdfs://master:9000/user/root/stopwords.txt" - 此修改提高了文件访问的准确性和可靠性 --- 3-1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3-1.py b/3-1.py index bf31c98..6424816 100644 --- a/3-1.py +++ b/3-1.py @@ -10,7 +10,7 @@ def tokenize(text): def load_stopwords(sc): try: - return set(sc.textFile("hdfs:///user/root/stopwords.txt").collect()) + return set(sc.textFile("hdfs://master:9000/user/root/stopwords.txt").collect()) except: # fallback to local with open("stopwords.txt", "r") as f: