apertium / apertium/apertium-python

Parsing slows down with each subsequent parse

オープン
#102 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
35
フォーク
27
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。