Reconocimiento de entidad nombrada (NER) en las revisiones de IMDB

Foto de Semiha Weber en Unsplash

“Me encantó la película Avatar. Los efectos visuales fueron increíbles y la actuación fue de primera categoría. El director, James Cameron, hizo un trabajo increíble al darle vida a la historia”.

import spacy

nlp = spacy.load("en_core_web_sm")

text = "I loved the movie Avatar. The visual effects were amazing and the acting was top-notch. The director, James Cameron, did an incredible job bringing the story to life."

doc = nlp(text)

for ent in doc.ents:
if ent.label_ == "MOVIE":
print("Movie name:", ent.text)
elif ent.label_ == "DIRECTOR":
print("Director name:", ent.text)
elif ent.label_ == "ADJ":
print("Adjective describing the acting:", ent.text)

Movie name: Avatar
Director name: James Cameron
Adjective describing the acting: top-notch

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Scroll al inicio