Toki Pona is a constructed, minimal language. This parser based on swi-prolog and definite clause grammars (dcg) and supports spelling, grammar check and ambiguity check of Toki Pona sentences.
test all lines in file toki-pona-sentences-right.txt to succeed.
test all lines in file toki-pona-sentences-wrong.txt to fail.
to run use: swipl -s toki-pona-test-files.pro
This will, however not work completely currently, because the line
ni li jan tu tu tu tu.
in file toki-pona-sentences-right.txt leads to an error:
|:ni li jan tu tu tu tu.
ERROR: number_radix_2/3: Undefined procedure: removing_extraneous_tree_nodes_abcde/3
ERROR: However, there are definitions for:
ERROR: removing_extraneous_tree_nodes_abcd/5
ERROR: removing_extraneous_tree_nodes_abcde/6
ERROR: removing_extraneous_tree_nodes_abcdef/7
Exception: (17) removing_extraneous_tree_nodes_abcde(_G1363, numeral(tu), epsilon) ?
But when you remove that line, the test runs fine. There are some lines, that should fail which don't and many lines that should succeed, but don't. A lot of the lines wrongly failing seem to be caused by missing/wrong punctuation marks.
test all lines in file toki-pona-sentences-right.txt to succeed. test all lines in file toki-pona-sentences-wrong.txt to fail.
to run use: swipl -s toki-pona-test-files.pro
This will, however not work completely currently, because the line
in file toki-pona-sentences-right.txt leads to an error:
But when you remove that line, the test runs fine. There are some lines, that should fail which don't and many lines that should succeed, but don't. A lot of the lines wrongly failing seem to be caused by missing/wrong punctuation marks.
And hey, it's Prolog only... ;-)