French NER with polyglot I
In this exercise and the next, you'll use the polyglot
library to identify French entities. The library functions slightly differently than spacy
, so you'll use a few of the new things you learned in the last video to display the named entity text and category.
You have access to the full article string in article
. Additionally, the Text
class of polyglot
has been imported from polyglot.text
.
This exercise is part of the course
Introduction to Natural Language Processing in Python
Exercise instructions
- Using the article string in
article
, create a newText
object calledtxt
. - Iterate over
txt.entities
and print each entity,ent
. - Print the
type()
ofent
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create a new text object using Polyglot's Text class: txt
txt = ____
# Print each of the entities found
for ____ in ____:
____
# Print the type of ent
____