AI and NLP Python Course
AI and NLP Python Course
Welcome to the full beginner-to-advanced guide to the Data Toolkit Course. This course covers
major Python libraries used in Data Science, Natural Language Processing, and Machine Learning
projects.
- TF-IDF & Cosine Similarity: For text classification, search, and chatbots
------------------------------------------------------------
import numpy as np
print(arr.shape)
# Example 2: Reshape and Operations
arr2 = arr.reshape(3, 2)
print(np.mean(arr2))
------------------------------------------------------------
Matplotlib is used for creating static, animated, and interactive visualizations in Python.
import numpy as np
y = np.sin(x)
plt.plot(x, y)
plt.title("Sine Wave")
plt.show()
y = [5, 7, 3]
plt.bar(x, y)
plt.show()
------------------------------------------------------------
NLTK is a library used for building Python programs that work with human language.
# Tokenization
word_tokenize("Hello world!")
# Stopwords
stopwords.words("english")
ps = PorterStemmer()
wl = WordNetLemmatizer()
print(ps.stem("running"))
print(wl.lemmatize("running", pos='v'))
------------------------------------------------------------
TF-IDF is used to measure the importance of words in a document. Cosine similarity checks how
close two vectors (texts) are.
# Example
corpus = ["I love apples", "Apples are sweet", "I hate sadness"]
vec = TfidfVectorizer()
X = vec.fit_transform(corpus)
cosine_similarity(X[0], X[1])
------------------------------------------------------------
------------------------------------------------------------
------------------------------------------------------------
Keep this guide as your quick reference while practicing the course.
Happy coding!