AI with Python
iv
9. AI with Python – Natural Language Processing ....................................................................................... 69
Components of NLP ....................................................................................................................................... 69
Difficulties in NLU .......................................................................................................................................... 69
NLP Terminology ........................................................................................................................................... 70
Steps in NLP ................................................................................................................................................... 70
10. AI with Python – NLTK package .............................................................................................................. 72
Importing NLTK .............................................................................................................................................. 72
Downloading NLTK’s Data ............................................................................................................................. 72
Installing Other Necessary Packages ............................................................................................................. 73
Concept of Tokenization, Stemming, and Lemmatization ............................................................................. 73
Chunking: Dividing Data into Chunks ............................................................................................................ 75
Types of chunking .......................................................................................................................................... 76
Bag of Word (BoW) Model ............................................................................................................................ 77
Concept of the Statistics ................................................................................................................................ 78
Building a Bag of Words Model in NLTK ........................................................................................................ 79
Solving Problems ........................................................................................................................................... 79
Topic Modeling: Identifying Patterns in Text Data ........................................................................................ 84
Algorithms for Topic Modeling ...................................................................................................................... 84
11. AI with Python – Analyzing Time Series Data .......................................................................................... 86
Introduction ................................................................................................................................................... 86
Installing Useful Packages ............................................................................................................................. 86
Pandas: Handling, Slicing and Extracting Statistic from Time Series Data ..................................................... 87
Extracting Statistic from Time Series Data .................................................................................................... 91
Analyzing Sequential Data by Hidden Markov Model (HMM)....................................................................... 95
Example: Analysis of Stock Market data........................................................................................................ 96
12. AI with Python – Speech Recognition ...................................................................................................... 99
Building a Speech Recognizer ........................................................................................................................ 99
Visualizing Audio Signals - Reading from a File and Working on it .............................................................. 100