Reconnaissance d'entités nommées

Introduction au traitement du langage naturel en Python

Katharine Jarmul

Founder, kjamistan

Qu'est-ce que la reconnaissance d'entités nommées ?

  • Tâche de TAL pour repérer les entités nommées clés dans le texte
    • Personnes, lieux, organisations
    • Dates, États, œuvres
    • … et d'autres catégories !
  • Peut s'utiliser avec l'identification de sujets
    • … ou seule !
  • Qui ? Quoi ? Quand ? Où ?
Introduction au traitement du langage naturel en Python

Exemple de REN

REN sur un article Wikipédia

(Source : Europeana Newspapers (http://www.europeana-newspapers.eu))

Introduction au traitement du langage naturel en Python

nltk et la bibliothèque Stanford CoreNLP

  • La bibliothèque Stanford CoreNLP :
    • Intégrée à Python via nltk
    • Fondée sur Java
    • Prend en charge la REN, la coréférence et les arbres de dépendances
Introduction au traitement du langage naturel en Python

Utiliser nltk pour la reconnaissance d'entités nommées

import nltk
sentence = '''In New York, I like to ride the Metro to 
              visit MOMA and some restaurants rated 
              well by Ruth Reichl.'''
tokenized_sent = nltk.word_tokenize(sentence)

tagged_sent = nltk.pos_tag(tokenized_sent)
tagged_sent[:3]
[('In', 'IN'), ('New', 'NNP'), ('York', 'NNP')]
Introduction au traitement du langage naturel en Python
print(nltk.ne_chunk(tagged_sent))
(S
  In/IN
  (GPE New/NNP York/NNP) 
  ,/,
  I/PRP
  like/VBP
  to/TO
  ride/VB
  the/DT
  (ORGANIZATION Metro/NNP)
  to/TO
  visit/VB
  (ORGANIZATION MOMA/NNP)
  and/CC
  some/DT
  restaurants/NNS
  rated/VBN
  well/RB
  by/IN
  (PERSON Ruth/NNP Reichl/NNP) 
  ./.)
Introduction au traitement du langage naturel en Python

Passons à la pratique !

Introduction au traitement du langage naturel en Python

Preparing Video For Download...