Integrating tagtog and spaCy: a simple example

By Jorge Campos

Taking the spaCy v3 release opportunity, we wanted to write a small piece about how to integrate tagtog and spaCy.

tagtog is a multi-user text annotation tool designed to build high-quality data efficiently. spaCy is an open-source library for advanced Natural Language Processing (NLP) in Python.

This example uses spaCy to automatically generate NER (Named-Entity Recognition) annotations and display these annotations directly in tagtog.

First, we create a project in tagtog and define a few entity types in the project settings. Bear in mind that these types should map those used by your model. We will use the spaCy’s model en_core_web_sm for English to extract entities representing people, organizations, and money. We review the model label scheme and find these labels: PERSON, ORG, and MONEY. In tagtog, we create similar entity types:

Image for post
Image for post
These entity types maps to the labels for the spaCy model

Second, we want to upload to tagtog a text annotated by this model. To do that, first we transform the annotations coming out of the spaCy model and transform them into the annotations tagtog can digest. Below you can find a commented Python code snippet that does the following:

  1. Given a sample text, it forwards it to the en_core_web_sm model.
  2. It transforms the model response into annotations tagtog can understand.
  3. It pushes the text and annotations (pre-annotated document) to tagtog using its API.

The sample text:

🪄Now you can find the annotated text in your tagtog project.

Image for post
Image for post
On the right side you find the different entity types found in the text. A user can correct the predictions of your model and then you can use this data for further training.

I hope you enjoyed the example! The whole project is public so take a look🍃 at: https://www.tagtog.net/jorge/demo-spaCy/

Please reach out for any questions!

Feel free to sign up at tagtog.net, and try this sample with your own model, it's free.

Like birds? Follow us on Twitter 🐦

👏👏👏 if you like the post, and want to share it with others! 💚🧡

The text annotation tool to train #AI. Easy. 🔗tagtog.net

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store