Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problemas con multimatch #10

Open
Sofia-uc opened this issue Jul 3, 2024 · 1 comment
Open

Problemas con multimatch #10

Sofia-uc opened this issue Jul 3, 2024 · 1 comment

Comments

@Sofia-uc
Copy link

Sofia-uc commented Jul 3, 2024

Cada vez qeu utilizo multimatch me aparece (tipo !a{!b{}}) me aparece como error
pyrematch._pyrematch.MultiSpannersNotAllowedException: Multi spanners are not allowed when using Query, use MultiQuery instead., pero no puedo cambiarlo, parece error de la libreria pero en la documentación aparece que si se puede usar

@gustavo-toro
Copy link
Collaborator

Hola,

Multi match básicamente te permite asociar una variable a una lista de spans, a diferencia del modo single span que asocia una variable a un único span. Para usar multi match en Python, tienes que agregar un flag

multiquery = REmatch.reql(pattern, flags=REmatch.Flags.MULTI_MATCH)

Ahora, para la actividad probablemente no tienes que usar multi match y el error que estás viendo es porque tienes una variable "repetida". Por ejemplo, patrones como !x{\w}!x{\w} o !x{\w}+ no son válidos en modo single span, porque hay ambigüedad acerca de qué carácter se captura en x, por lo que tienes que revisar que en el patrón no tengas una variable repetida o una variable bajo un operador de repetición.

De todas formas, si te interesa puedes revisar el tutorial o los ejemplos de la página web rematch.cl.

Me dices si te quedan dudas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants