Typed Japanese

https://news.ycombinator.com/rss Hits: 7
Summary

๐ŸŒธ Typed Japanese If you can write TypeScript, you can understand Japanese! Typed Japanese is a TypeScript type-level library that enables the expression of complete Japanese sentences through the type system. It creates a domain-specific language (DSL) based on Japanese grammar rules, allowing a subset of grammatically correct natural language to be written and verified using TypeScript's compiler. This project also explores an intermediate format for AI in language learning. For example, LLMs could return grammar analysis of Japanese sentences using this format instead of JSON, enabling verification through TypeScript's type checker to improve correctness. ๐Ÿ“– Want to learn more? Check out our detailed blog post which explains how the TypeScript type system can be used to learn Japanese grammar from the ground up. The article starts with basic programming concepts and gradually builds up to complex Japanese grammatical structures like conditional sentences and interrogative phrases. // Define the proper noun "ใƒ’ใƒณใƒกใƒซ" type ใƒ’ใƒณใƒกใƒซ = ProperNoun < "ใƒ’ใƒณใƒกใƒซ" > ; // Define ใ™ใ‚‹ verb type ใ™ใ‚‹ = IrregularVerb & { dictionary : "ใ™ใ‚‹" } ; // Create the ใใ†ใ—ใŸ pattern (past form of ใใ†ใ™ใ‚‹) type ใใ†ใ—ใŸ = DemonstrativeAction < Demonstrative & "ใใ†" , ใ™ใ‚‹ , "ใŸๅฝข" > ; // Create the conditional phrase "ใƒ’ใƒณใƒกใƒซใชใ‚‰ใใ†ใ—ใŸ" type ใƒ’ใƒณใƒกใƒซใชใ‚‰ใใ†ใ—ใŸ = ConditionalPhrase < ใƒ’ใƒณใƒกใƒซ , "ใชใ‚‰" , ใใ†ใ—ใŸ > ; // Type checking examples const properExample : ใƒ’ใƒณใƒกใƒซใชใ‚‰ใใ†ใ—ใŸ = "ใƒ’ใƒณใƒกใƒซใชใ‚‰ใใ†ใ—ใŸ" ; // "If it were Himmel, he would do so" // ๅฆ‚ๆžœๆ˜ฏ่พ›็พŽๅฐ”็š„่ฏ๏ผŒไป–ไนŸไผš่ฟ™ไนˆๅš็š„ ๐Ÿค– Verb System Verb Classes Japanese verbs are categorized into three main classes: Godan Verbs (ไบ”ๆฎตๅ‹•่ฉž) - Also known as "Group 1" or "u-verbs" Endings: ใ†, ใ, ใ, ใ™, ใค, ใฌ, ใถ, ใ‚€, ใ‚‹ Examples: ่ฉฑใ™ (hanasu - to speak), ๆ›ธใ (kaku - to write) Ichidan Verbs (ไธ€ๆฎตๅ‹•่ฉž) - Also known as "Group 2" or "ru-verbs" Always end with ใ‚‹ Examples: ้ฃŸในใ‚‹ (taberu - to eat), ่ฆ‹ใ‚‹ (miru - to see) Irregular Verbs (ไธ่ฆๅ‰‡ๅ‹•่ฉž) - Only two main verbs ใ™ใ‚‹ (suru - to do) ๆฅใ‚‹ (kuru - to come) Verb Conjugation Forms The system supports these conjugation...

First seen: 2025-03-29 18:29

Last seen: 2025-03-30 00:31