Typed Japanese: Expressing Natural Language Grammar with TypeScript Types
github.comThis is really interesting! You mention using LLMs to parse sentences in strongly typed prompts, but how would this work with the prevalence of tolerated grammatical errors in most languages? Would such a parsing always be "pass/fail" or would you be able to get a degree of correctness?
You've raised an excellent point about natural language flexibility! Indeed, a strict pass/fail system would struggle with the grammatical variations found in everyday language.
Textbook examples are ideal for this approach precisely because they demonstrate grammatical structures with intentional precision. Rather than binary pass/fail results, we could implement degrees of type conformance with specific error messages tied to common mistakes. This makes the approach particularly valuable in educational contexts, where a textbook-aligned type system could provide scaffolded feedback as learners progress.
In essence, textbook examples with their corresponding type annotations could serve as a "test262" suite for natural language learning - a reference collection against which learners can validate their understanding within a controlled, educational environment.