Building Domain Specific Language Models

intermediate Python • intermediate NLTK • beginner PyTorch or TensorFlow • intermediate NLP • basics of deep learning
skills learned
data manipulation with NumPy and pandas • text preprocessing with NLTK • train an RNN with PyTorch • score and evaluate language models
Alexis Perrier
4 weeks · 8-10 hours per week · ADVANCED
filed under
This title has been retired and is no longer for sale.
Look inside
In this liveProject, you’ll step into the role of a natural language processing data scientist working for Stack Exchange. Stack Exchange runs a network of question-and-answer sites on diverse topics ranging from programming to cooking. Your boss wants you to create language models that are tuned to the particular vocabulary of different Stack Exchange sites. Language is domain specific, for example an insurance company’s documents will use very different terminology than a post on a social media site. Because of this, off-the-shelf NLP models trained on generic text can be inaccurate for specialized domains. Your goal is to build a language model capable of query completion, text generation, and sentence selection for the domain-specific language of the Cross Validated statistics and machine learning site. Challenges you will tackle include preparing your datasets, building and evaluating n-gram word-based language models, and building a character-based language model with AllenNLP.
This project is designed for learning purposes and is not a complete, production-ready application or solution.

book resources

When you start your liveProject, you get full access to the following books for 90 days.

project author

Alexis Perrier
Alexis Perrier is a data science consultant specialized in predictive modeling and natural language processing. He holds a master’s in probability from Sorbonne Universités and a PhD in signal processing from Telecom Paris. He is the author of several books and online courses on data science.


This course is for proficient Python programmers who have experience with text-based machine learning. This course uses Python 3.7. It is recommended that you use the Anaconda distribution of Python and conda for managing the libraries. To begin this liveProject, you will need to be familiar with:

  • Basics of NumPy
  • Basics of pandas
  • Intermediate NLTK
  • Basics of creating neural networks with PyTorch, TensorFlow, or Keras
  • Basics of recurrent neural networks and LSTMs
  • Basics of word embeddings
  • Intermediate seq2seq models, algebra and probabilities, such as matrix manipulation, chain rule, and independence

you will learn

In this liveProject, you’ll learn to build a domain-focused language model using deep learning. You’ll develop skills in Python scripting, and neural networks creation and training. At the end of this project, you will be able to build a foundation for any domain specific NLP system by creating specialized, robust and efficient language models.

  • Python scripting, including object oriented programming
  • Data manipulation with NumPy and pandas
  • Text preprocessing such as pattern removal with regular expressions, text manipulation, and tokenization with NLTK
  • Designing and training recurrent neural networks with PyTorch
  • Scoring and evaluating language models for different tasks
  • Summarizing findings of a data science project effectively


You choose the schedule and decide how much time to invest as you build your project.
Project roadmap
Each project is divided into several achievable steps.
Get Help
While within the liveProject platform, get help from other participants and our expert mentors.
Compare with others
For each step, compare your deliverable to the solutions by the author and other participants.
book resources
Get full access to select books for 90 days. Permanent access to excerpts from Manning products are also included, as well as references to other resources.