IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Introduction to Natural Language Processing in Python

Visualizza il corso

Istruzioni dell'esercizio

  • Using the article string in article, create a new Text object called txt.
  • Iterate over txt.entities and print each entity, ent.
  • Print the type() of ent.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# 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
____
Modifica ed esegui il codice