$ show typedgrammar/typed-japanese
Typed Japanese is a TypeScript type-level library that models Japanese grammar as composable generic types, enabling the construction of grammatically valid Japanese sentences entirely within the type system. The core library defines interfaces for verbs (godan, ichidan, irregular), adjectives (i-adjectives, na-adjectives), copulas, particles, and sentence patterns, using template literal types and conditional types to encode conjugation rules. This allows developers to write Japanese sentences as type aliases that resolve to the exact Japanese string, with the TypeScript compiler acting as a grammar validator. The repository also includes an interactive playground web application (React + Vite + Monaco Editor) where users can explore the type system, write and analyze sentences, and follow a bilingual (English/Chinese) tutorial course spanning 47 chapters from elementary to advanced levels. A macOS app (TypedTranslate) provides a native interface for grammar annotation and chat, using a Bun bridge to integrate with the type system and LLMs (Codex/Claude). The project is hybrid in nature: while primarily an application/library, it includes a substantial data/research component in the form of curated evaluation datasets, an LLM annotation pipeline, and a rigorous iterative eval loop that measures conformance, reliability, and capability across grammar categories. The eval system produces quantifiable scoreboards and drives systematic improvements to the library's type definitions, prompt templates, and tutorial content.
The LLM identified 4 files worth highlighting for reuse:
Defines the core verb conjugation system using TypeScript's template literal and conditional types. Models godan, ichidan, suru, and irregular verbs with generic interfaces that encode stem/ending patterns. Conjugation functions like ConjugateVerb<T, Form> resolve to the correct inflected string at compile time. This pattern is the foundation of the entire library and demonstrates a novel application of TypeScript's type system for linguistic modeling.
Builds a composition tree from Typed Japanese type expressions by leveraging the TypeScript compiler API. Parses type aliases, resolves generic instantiations, and constructs a hierarchical tree of grammar nodes (verb parts, particle parts, etc.) with their resolved string values. This component is the core analysis engine for the playground's interactive visualization and is reusable for any project needing to introspect type-level DSLs.
A CLI tool that uses OpenAI Codex or Claude to generate Typed Japanese type annotations from natural language Japanese sentences. Implements a retry loop with structural audit and type-checking verification, producing verified snippets that are installed into the gallery. The prompt engineering, hard rules, and verification pattern are reusable for any AI-assisted code generation task requiring type-level correctness.
Implements a cross-review workflow for evaluating Typed Japanese annotations against a six-dimension rubric (POS accuracy, morpheme decomposition, particle integrity, conjugation correctness, resolution fidelity, idiomatic analysis). Supports independent judges, score aggregation, and findings synthesis. This pattern is reusable for any quality assurance process requiring structured, multi-rater evaluation of generated content.