vgel / treebender

A HDPSG-inspired symbolic natural language parser written in Rust
MIT License
44 stars 1 forks source link

Regex tokens #2

Open vgel opened 4 years ago

vgel commented 4 years ago

Right now to define, e.g., a digit, you have to do:

Cows -> Digit[ num: sg ] cow
Cows -> Digit[ num: pl ] cows
Digit[ num: pl ] -> 0
Digit[ num: sg ] -> 1
Digit[ num: pl ] -> 2
Digit[ num: pl ] -> 3
Digit[ num: pl ] -> 4
Digit[ num: pl ] -> 5
Digit[ num: pl ] -> 6
// ...

This is bad. Should be this:

Cows -> Digit[ num: sg ] cow
Cows -> Digit[ num: pl ] cows
Digit[ num: pl ] -> /[02-9]/
Digit[ num: sg ] -> 1