lark-parser / lark

Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
MIT License
4.81k stars 409 forks source link

Get parse weight out of cyk parser #138

Closed uriva closed 4 years ago

uriva commented 6 years ago

CYK doesn't currently expose the best parse's weight - would be good to have it via tha API.

erezsh commented 6 years ago

Any ideas on how that API will look?

uriva commented 6 years ago

The parse object in https://github.com/lark-parser/lark/blob/master/lark/parsers/cyk.py#L135 has a property weight, which can be set on the Tree type if we add an attribute of weight to it.

erezsh commented 6 years ago

Looks like a simple patch. https://github.com/lark-parser/lark/blob/master/lark/parsers/cyk.py#L149 already sets rule, someone just needs to add weight as well.

erezsh commented 4 years ago

Removed for lack of public interest. Reopen this is still needed.