Building a knowledge graph in python from scratch

Rabin Poudyal
4 min readJan 12, 2020

A knowledge graph is one of the widely used applications of machine learning that tech giants like Google and Microsoft are using in their search engine to provide search results quickly and efficiently. For example, if we search about “Barak Obama” on google, we can see few information about him in the right side of results page without even clicking any of the links.

This has been possible only because, Google has been able to crawl information about these famous people and form a graph of their details. We are going to use the spacy NLP library to build a simple knowledge graph from scratch. Spacy is one of my favourite libraries for NLP for operations such as entity extraction, classification, dependency parsing, and more.

We are going to use the dependency parsing technique to extract information from these unstructured data.

The datasets used in the following tutorial have been obtained from Wikipedia but you are free to use the dataset of your own choice until it is a text data.

Note that information extraction and representation are a vast topic and there are tons of ways of extracting information besides the…

--

--