ComenzarEmpieza gratis

Más regex con re.search()

En este ejercicio, vas a utilizar re.search() y re.match() para encontrar tokens concretos. Tanto search como match esperan patrones regex, similares a los que definiste en un ejercicio anterior. Aplicarás estos métodos de la librería de regex al mismo texto de Monty Python del corpus de nltk.

Tienes disponibles scene_one y sentences del ejercicio anterior; ahora puedes usarlos con re.search() y re.match() para extraer y hacer coincidir más texto.

Este ejercicio forma parte del curso

Introducción al Natural Language Processing en Python

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Search for the first occurrence of "coconuts" in scene_one: match
match = re.____("____", scene_one)

# Print the start and end indexes of match
print(____, ____)
Editar y ejecutar código