11 Information extraction and knowledge graphs
This chapter covers
- Extracting named entities from text
- Understanding the structure of sentences using dependency parsing
- Converting a dependency tree into knowledge
- Building a knowledge graph from text
In chapter 10, you learned how to use large transformers to generate words that sound smart. But language models on their own are just faking it by predicting the next word that will sound reasonable to you. Your AI can’t reason about the real world until you give it access to facts and knowledge about the world. In chapter 2, you learned how to do exactly this, but you didn’t know it then. You were able to tag tokens with their part of speech and their logical role in the meaning of a sentence (dependency tree). This old-fashioned token-tagging algorithm is all you need to give your generative language models (AI) knowledge about the real world. The goal of this chapter is to teach your bot to understand what it reads. And you’ll put that understanding into a flexible data structure designed to store knowledge, known as a knowledge graph. Then, your bot can use that knowledge to make decisions and say smart stuff about the world.