apertium / apertium/apertium-python

Parsing slows down with each subsequent parse

Abierto
#102 3 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
35
Forks
27
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Python 3.8.10
apertium-python 0.2.3
apertium 3.8.1
Ubuntu 20.04 (running under WSL)

Reproducing code:
```
import apertium
import time

i = 0
parser = apertium.Analyzer('eng')
while True:
then = time.time()
parser.analyze("Why does this keep getting slower?")
now = time.time()
print("Parsing {} took {}".format(i, now - then))
i += 1
```
When I run this code, the time taken for the same parse gradually increases. In the first few iterations it takes about 0.0009 seconds per parse, but by iteration 1000 it takes about 0.03 seconds, and it increases from there. Moving `parser = apertium.Analyzer('eng')` within the loop doesn't solve the problem. If I use the `hfst` library to run the transducer instead, no slowdown is observed.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.