Your script is attempting to load the spam_collection.csv
file from a relative path. Relative paths are loaded relative to where python
is being invoked, not where the source file is.
This means that when you're running your module from the bigramspamclassifier
directory, this will work. However, once your module is pip
-installed, file will no longer be relative to where you're running your code from (it will be buried somewhere in your installed libraries).
You can instead load relative to the source file by doing something like:
import os
this_dir, this_filename = os.path.split(__file__)
DATA_PATH = os.path.join(this_dir, "data", "spam_collection.csv")
fullCorpus = pd.read_csv(DATA_PATH, sep="", header=None)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…