Grammars and RuleBases
Download language RuleBases and provide their directory URLs to the RoboCrunch Engine.
The current RoboCrunch API supports Tau / Comprehension. Other Level/Direction settings return an error.
English — Tau / Comprehension
This RuleBase processes character graphs. For the input character a, it introduces Labels such as 'a', V, and the boundary marker #.
Phonological Labels use single quotes, such as 'a' and 'th'. The apostrophes are part of the Label IDs. This is a naming convention for the examples.
Use this directory URL as the API request's ruleBaseUrl:
https://symsuper.com/grammars/english-tau-c/
| File | Contents |
|---|---|
| RuleBase.txt | The English rules, with one rule per nonblank line. |
| LevelDirection.txt | The Level and Direction settings for this RuleBase. |
Download the two files:
Use the RuleBase from Python
Download robocrunch.py from the RoboCrunch API page and place it beside your Python program:
from robocrunch import Graph, RoboCrunchClient
client = RoboCrunchClient(api_url="https://robocrunch.net/api/run")
graph = Graph.from_text(text="a")
result = client.run(rule_base_url="https://symsuper.com/grammars/english-tau-c/", graph=graph)
result.write_file(path="OutputGraph.txt")
The tested result for this sample contains 14 nodes and 18 edges. Its graph preserves three legitimate paths, including a path that is inferior to another.
Verified examples
These API results were checked on . Every output path retained the sample's characters, spaces, and punctuation in order.
| Input text | Output nodes | Output edges | Full Token paths |
|---|---|---|---|
cat | 23 | 35 | 12 |
a cat | 32 | 54 | 36 |
cat? | 28 | 42 | 12 |
Node counts include Label nodes. The output graph retains its alternatives; see the graph reference for the meaning of these counts.
With robocrunch.py beside your program, run all three examples:
from robocrunch import Graph, RoboCrunchClient
client = RoboCrunchClient(api_url="https://robocrunch.net/api/run")
cases = (("cat", "cat"), ("a-cat", "a cat"), ("cat-question", "cat?"))
for name, text in cases:
graph = Graph.from_text(text=text)
result = client.run(rule_base_url="https://symsuper.com/grammars/english-tau-c/", graph=graph)
result.write_file(path=f"{name}-OutputGraph.txt")
print(f"{text!r}: {result.output_graph.node_count} nodes, {result.output_graph.edge_count} edges.")
Each output file contains the complete returned graph. The verified counts describe the RuleBase used for these checks; changing the rules can change the graph.
Host your own RuleBase
Grammar writers can publish their RuleBase files on their own servers. The API must be able to download both files directly from a public HTTP or HTTPS directory without signing in.
| Required file | Format |
|---|---|
RuleBase.txt | UTF-8 text, one rule per nonblank line, with exactly one => separator in each rule. |
LevelDirection.txt | UTF-8 text containing the Level and Direction settings. |
For the current API, use these settings:
Level=Tau
Direction=Comprehension
Provide the directory URL in ruleBaseUrl. The API loads RuleBase.txt and LevelDirection.txt from that directory.
RuleBase.txt is limited to 1 MiB. API.txt is reserved, is currently ignored, and is not required.
Provide the input separately, as graph text or a public graph-file URL. See the API request examples and the graph format reference.