Your Turn

Managing databases is a major scientific field that is well beyond the scope of this book. Reading this chapter alone won’t make you a seasoned database administrator or a versatile database programmer. But, now you can create a table or two, store data into them, and get the data back when you need it, and you can do it two ways: with or without SQL.

MySQL File Indexer*

Write a Python program that, for each word in a given file, records the word itself (not the stem!), its ordinal number in the file (starting from 1), and the part-of-speech marker in a MySQL database. Use NLTK WordPunctTokenizer (introduced here) to recognize words. Assume that the words are short enough to fit in the TINYTEXT MySQL data type. Design the database ...

Get Data Science Essentials in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.