HACKER Q&A
📣 alhirzel

Parser for pseudo-English domain-specific languages?


I am wondering if anyone knows of a parsing framework or existing tool that would help in evaluating pseudo-English-language statements that express models.

For example, it would let me write a tool to parse something like OPL[1], or maybe someone's text describing a house, and get out a structural decomposition and graph of requirements from statements like these:

"A full bathroom consists of a shower, tub, and sink. A bedroom consists of a bed and closet. A laundry room consists of a washer and dryer. The noise isolation between the washer and bed shall be high. The walking path between the closet and washer shall be less than 25ft."

This would have keywords like "consists of" and "shall". Of course I could write a full-up validating parser manually using lex/yacc, Perl 6 grammars[2], Parsec, etc. I am just looking for any more focused tools that could make this quicker.

[1]: https://en.wikipedia.org/wiki/Object_Process_Methodology#Basics

[2]: https://www.oreilly.com/library/view/perl-6-essentials/0596004990/ch04s06.html


  👤 PaulHoule Accepted Answer ✓

👤 dtagames
Google has an API that breaks down the numbers, locations, and some other parts of speech. I tried your text in the demo on this page[0]. The "Syntax" tab in particular might have the info you're looking for.

[0] https://cloud.google.com/natural-language#section-2