Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions 2-svd-nmf-topic-modeling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
}
],
"source": [
"from sklearn.feature_extraction import stop_words\n",
"from sklearn.feature_extraction import _stop_words as stop_words\n",
"\n",
"sorted(list(stop_words.ENGLISH_STOP_WORDS))[:20]"
]
Expand Down Expand Up @@ -420,7 +420,8 @@
],
"source": [
"import nltk\n",
"nltk.download('wordnet')"
"nltk.download('wordnet')\n",
"nltk.download('omw-1.4')"
]
},
{
Expand Down Expand Up @@ -568,8 +569,8 @@
"metadata": {},
"outputs": [],
"source": [
"from spacy.lemmatizer import Lemmatizer\n",
"lemmatizer = Lemmatizer()"
"nlp = spacy.load(\"en_core_web_sm\")\n",
"doc = nlp(\" \".join(word_list))"
]
},
{
Expand All @@ -589,7 +590,7 @@
}
],
"source": [
"[lemmatizer.lookup(word) for word in word_list]"
"[word.text for word in doc]"
]
},
{
Expand Down Expand Up @@ -901,7 +902,7 @@
"metadata": {},
"outputs": [],
"source": [
"vocab = np.array(vectorizer.get_feature_names())"
"vocab = np.array(vectorizer.get_feature_names_out())"
]
},
{
Expand Down
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Makefile
# description: Install virtual environment and libraries to run course notebooks.

PYTHON_VENV = .venv

init: venv lib pipeline

# Install required libraries.
lib:
@. $(PYTHON_VENV)/bin/activate && pip install \
fbpca \
matplotlib \
nltk \
numpy \
sklearn \
spacy

# Download spacy pipeline.
pipeline:
. $(PYTHON_VENV)/bin/activate && python -m spacy download en_core_web_sm

# Create virtual environment.
venv:
test -d $(PYTHON_VENV) || python3 -m venv $(PYTHON_VENV)

.PHONY: lib pipeline