Skip to content

Commit afe2b24

Browse files
docs(ttr): update setup instructions and add quickstart example for parser usage
1 parent a5cf9ac commit afe2b24

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,36 @@
77
You need [uv](https://docs.astral.sh/uv/) and a Python that satisfies `>=3.11`.
88

99
1. Create a virtual environment with a fixed Python version (run this in the directory where you want `.venv`, e.g. the repo root for a clone):
10-
1110
```bash
1211
uv venv --python 3.11 # or 3.12 or 3.13
1312
```
14-
15-
1. Activate it. On Linux or macOS:
16-
13+
2. Activate it. On Linux or macOS:
1714
```bash
1815
source .venv/bin/activate
1916
```
20-
2117
On Windows, use `.venv\Scripts\activate` (cmd) or `.\.venv\Scripts\Activate.ps1` (PowerShell).
2218
3. Install into that environment, using the published package from PyPI:
23-
2419
```bash
2520
uv pip install dynamicsyntax
2621
```
2722

2823
## Examples
2924

30-
For some code examples of the parser in action, check out this notebook: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ofpCLwLOE88AvbtR3gh5uisaYkpWGNP9?usp=sharing)
25+
For some code examples of how to use the parser in action, check out this notebook: [Open In Colab](https://colab.research.google.com/drive/1ofpCLwLOE88AvbtR3gh5uisaYkpWGNP9?usp=sharing)
26+
27+
### Quickstart
28+
29+
```python
30+
import dynamicsyntax as ds
31+
32+
p = ds.parse("a man knows you", "ttr")
33+
print(p.semantics) # TTR semantics based on the default grammar/lexicon
34+
print(p.vis()) # Visualise the parse tree
35+
```
3136

3237
## Get Involved
3338

3439
Contributions (issues, PRs, [donations (spent on coffee/LLM credits!)](https://buymeacoffee.com/incrementaliser)) are very welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
3540

3641
**Note**
37-
Since this project has been translated using Cursor and tested only on Windows, there is a small chance errors exist. I would be grateful if you could report them to me through the above channels. Although, it is important to mention that some of the most critical methods here have been verified via unit tests, so there is a high chance the migration from Java has been correct so far.
42+
Since this project has been translated using Cursor and tested only on Windows, there is a small chance errors exist. I would be grateful if you could report them to me through the above channels. Although, it is important to mention that some of the most critical methods here have been verified via unit tests, so there is a high chance the migration from Java has been correct so far.

0 commit comments

Comments
 (0)