fix(3-1): 更新 stopwords.txt 文件路径
- 将 HDFS 文件路径从相对路径改为绝对路径 - 新路径为 "hdfs://master:9000/user/root/stopwords.txt" - 此修改提高了文件访问的准确性和可靠性
This commit is contained in:
parent
c699e3d21e
commit
4233cfc792
2
3-1.py
2
3-1.py
@ -10,7 +10,7 @@ def tokenize(text):
|
|||||||
|
|
||||||
def load_stopwords(sc):
|
def load_stopwords(sc):
|
||||||
try:
|
try:
|
||||||
return set(sc.textFile("hdfs:///user/root/stopwords.txt").collect())
|
return set(sc.textFile("hdfs://master:9000/user/root/stopwords.txt").collect())
|
||||||
except:
|
except:
|
||||||
# fallback to local
|
# fallback to local
|
||||||
with open("stopwords.txt", "r") as f:
|
with open("stopwords.txt", "r") as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user