I am building a basic latin translator in Prolog. I have data which I currently store in this format as predicates:
noun("femin","femin",1,"f",translation("woman","women")).
verb("port", "portare", "portav", "portat", 1, translation("carry","carrying","carried")).
nounending("ae","with",sg).
I would rather use something like a spreadsheet to input the nouns and verbs. I have thought of parsing a .csv to a .pl but this is an unwieldy solution. Is there a way to easily input predicates in SWI-Prolog using a spreadsheet-like application?
I would rather use something like a spreadsheet to input the nouns and verbs.
A spreadsheet is a great way to describe live, functional relations among Entities, but I fear you will have to bite-the-bullet and go the unwieldy way, reading CSV.
Is not that bad, SWI-Prolog for instance has a CSV library, or you could use it as a case study (assuming you're interested in Prolog) and write your own DCG. A much rewarding exercise...
Another possibility, if you can write a bit of code on Spreadsheet side, you could output spreadsheet' cells in Prolog format:
cell(1,1,'Hello').
cell(1,2,'World').
Or consider that any relational editor (your preferred 'Db Admin tool') could be useful to input tabular data, and since then you access it using your Prolog RDB interface (like ODBC).
Note: a spreadsheet is usually easy to save in a table. Then access via RDB is granted.
edit It come to my mind that after saving the table (as SQL dump), pack(prosqlite) -in SWI-Prolog - will grant you access to your most valuable cells :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With