https://github.com/bpevs/conjugation
Tools for language conjugation transformations
https://github.com/bpevs/conjugation
Last synced: about 1 year ago
JSON representation
Tools for language conjugation transformations
- Host: GitHub
- URL: https://github.com/bpevs/conjugation
- Owner: bpevs
- Created: 2024-09-21T06:24:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-22T07:18:21.000Z (over 1 year ago)
- Last Synced: 2025-03-19T05:31:20.430Z (about 1 year ago)
- Language: TypeScript
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Conjugation
A set of tools for doing conjugation transformations in various languages. I
will focus on keeping them to have similar usage patterns and types, to make
integrating them easier.
Since I am tending to build off of prior work, each language may have different
license conditions and usage. Please refer to the individual locale directories.
## Import
This library is published to [jsr.io](https://jsr.io/@bpev/conjugation), and can
be used in various runtimes.
- npm: `npx jsr add @bpev/conjugation`
- deno: `deno add @bpev/conjugation`
- bun: `bunx jsr add @bpev/conjugation`
- yarn: `yarn dlx jsr add @bpev/conjugation`
- pnpm: `pnpm dlx jsr add @bpev/conjugation`
For usage in the browser, we can import from esm.sh:
```js
import conjugate from 'https://esm.sh/jsr/@bpev/conjugation/ja'
```
## Usage
### Japanese
```ts
import conjugate, { ConjugationType, PartOfSpeech } from '@bpev/conjugation/ja'
const result = conjugate('あう', {
affirmative: true,
polite: false,
type: ConjugationType.Past,
pos: PartOfSpeech.VerbGodan,
})
assert(result, ['あった'])
```
Supported conjugation targets are:
```ts
ConjugationType.Past
ConjugationType.Present
// Adjective Only
ConjugationType.Adverb
// Verb Only
ConjugationType.Causative
ConjugationType.Imperative
ConjugationType.Passive
ConjugationType.Potential
ConjugationType.Te
ConjugationType.Volitional
```
Supported parts of speech (for input) are:
```ts
PartOfSpeech.Adjectiveな
PartOfSpeech.Adjectiveい
PartOfSpeech.VerbGodan
PartOfSpeech.VerbIchidan
PartOfSpeech.VerbIrregular
PartOfSpeech.Verbする
```