loodos / zemberek-python

Python implementation of Zemberek
Other
113 stars 14 forks source link

Can't pickle TurkishMorphology object #4

Closed bediiaydogan closed 3 years ago

bediiaydogan commented 3 years ago

First of all, thanks for this great repository. It all works fine, but the instantiation of TurkishMorphology takes long time (about 12 secs in my computer), I tried to pickle the instance to be used in production. But I got 'TypeError: cannot pickle '_thread.lock' object' error. Is there any way to pickle the instance or any workaround to solve the late instantiation problem.

harun-loodos commented 3 years ago

Hi, thanks for the feedback. We also suffer from long initiating times for TurkishMorphology and TurkishSentenceNormalizer and unfortunately we couldn't come up with a solution.

As for the pickling problem, TurkishMorphology class is in a relationship with almost every other class in the project. And since pickling an instance of the class requires access to all the attributes, a potential mistake in another class could prevent pickling TurkishMorphology objects. This situation makes debugging really difficult for complex classes such as TurkishMorphology. Right now, I don't have enough free time to maintain and improve this repo. Probably there won't be any update regarding this issue for some time so I am closing it for now.

Sorry for late response and not helping at all. I hope we can reconsider the issue as soon as possible.