Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert natural language parser to BNF #9

Open
cogat opened this issue May 22, 2017 · 7 comments
Open

Convert natural language parser to BNF #9

cogat opened this issue May 22, 2017 · 7 comments

Comments

@cogat
Copy link
Contributor

cogat commented May 22, 2017

The current natural language parser is hand-baked in Python. It can probably be translated to BNF, to do more advanced, easier-to-customise and easier-to-translate parsing.

@intrepidocabral
Copy link

What is BNF?

@cogat
Copy link
Contributor Author

cogat commented Jun 14, 2018

https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form

It's how the EDTF is specified. But we could use the same technique for describing common forms of natural language descriptions of dates, rather than the handmade python approach.

In other words, if we can derive the meaning of a date described in natural language using a pyparsing grammar, then the description is more maintainable/customisable/pluggable for different use cases or languages.

@workergnome
Copy link

If you're interested, you can look at some of the work I've done on expressing this as a formal grammar in Ruby, at https://github.com/arttracks/cultural_dates. I'm hoping to port the grammar over to JS in the near future, as well, and might need it (or something similar) in Python.

@intrepidocabral
Copy link

thanks for answer the question.

@rlskoeser
Copy link

@workergnome I know this comment is from ages ago ...

If you're interested, you can look at some of the work I've done on expressing this as a formal grammar in Ruby, at https://github.com/arttracks/cultural_dates. I'm hoping to port the grammar over to JS in the near future, as well, and might need it (or something similar) in Python.

... but could you share the status? And/or point me to the right places in your ruby & js code? (I maybe found some of it, want to make sure I'm looking at the right things.) Did you ever generalize or port to python? If not, what do you think it would take to do that?

@workergnome
Copy link

Sure thing! The date logic is embedded in the https://github.com/workergnome/arttracks-js repo (in Javascript), and there's a demo of it here: https://date-calculator.davidnewbury.com. The code for the demo is https://github.com/workergnome/date-calculator.

Never did anything in Python with it, unfortunately.

If you have questions, shoot me an email at [email protected]?

@rlskoeser
Copy link

@workergnome thanks for the response! Will follow up by email when I get the chance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants