drmfinlay / pyjsgf

JSpeech Grammar Format (JSGF) compiler, matcher and parser package for Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to serialize PublicRule object?

rhyspang opened this issue · comments

I want to serialize the PublicRule object using dill. but I got an error AttributeError: 'ChildList' object has no attribute '_expansion' when I load the dumped object.
Is there any way to serialize the object?

Thanks for reporting this! Admittedly serialisation wasn't something I had in mind for this library, but I will look into fixing the problem and other issues I come across using dill.

This problem is tricky to solve because ChildList's side-effects are fundamentally incompatible with Python's serialisation/pickling approach. I think the best solution would be to remove those side-effects. I will do this in version 1.8.0 and try to keep it backwards compatible.

For the moment though, wouldn't the parser be good enough?

This is now fixed in version 1.8.0.