import spacy # Importa el Matcher from spacy.____ import ____ nlp = spacy.load("es_core_news_sm") doc = nlp( "Los Olímpicos de Tokio 2020 son la inspiración para la nueva " "colección de zapatillas adidas zx." ) # Inicializa el matcher con el vocabulario compartido matcher = ____(____.____) # Crea un patrón que encuentre dos tokens: "adidas" y "zx" pattern = [____] # Añade el patrón al matcher ____.____("ADIDAS_ZX_PATTERN", None, ____) # Usa al matcher sobre el doc matches = ____ print("Resultados:", [doc[start:end].text for match_id, start, end in matches])
import spacy # Importe le Matcher from spacy.____ import ____ nlp = spacy.load("en_core_web_sm") doc = nlp("Upcoming iPhone X release date leaked as Apple reveals pre-orders") # Initialise le matcher avec le vocabulaire partagé matcher = ____(____.____) # Crée un motif qui recherche les deux tokens : "iPhone" et "X" pattern = [____] # Ajoute le motif au matcher ____.____("IPHONE_X_PATTERN", None, ____) # Utilise le matcher sur le doc matches = ____ print("Résultats :", [doc[start:end].text for match_id, start, end in matches])
import spacy # Importe le Matcher from spacy.____ import ____ nlp = spacy.load("fr_core_news_sm") doc = nlp("Le constructeur Citröen présente la e-Méhari Courrèges au public.") # Initialise le matcher avec le vocabulaire partagé matcher = ____(____.____) # Crée un motif qui recherche les deux tokens : "e-Méhari" et "Courrèges" pattern = [____] # Ajoute le motif au matcher ____.____("MEHARI_PATTERN", None, ____) # Utilise le matcher sur le doc matches = ____ print("Résultats :", [doc[start:end].text for match_id, start, end in matches])