Decline and conjugate Latin nouns, verbs, adjectives, and adverbs
Install scriptor
from JSR using one of the following commands.
bunx jsr add @hugo-t-b/scriptor
deno add @hugo-t-b/scriptor
npx jsr add @hugo-t-b/scriptor
yarn dlx jsr add @hugo-t-b/scriptor
pnpm dlx jsr add @hugo-t-b/scriptor
Pass the principal parts of a word to scriptor
as a string or array. It will automatically detect the word's part of speech.
import scriptor from "@hugo-t-b/scriptor";
const fromString = scriptor("scriptor, scriptoris, m"); // Principal parts string
const fromArray = scriptor([ "scriptor", "scriptoris", "m" ]); // Principal parts array
scriptor
will return an object with every (supported) form of the word, which can be traversed to obtain individual forms.
{
nominative: {
singular: "scriptor",
plural: "scriptores"
},
vocative: {
singular: "scriptor",
plural: "scriptores"
},
accusative: {
singular: "scriptorem",
plural: "scriptores"
},
...
}
Tip
The full list of supported forms and principal parts can be found in the support section.
The expected return type can be passed to scriptor
as a generic for better intellisense.
import scriptor, { type Noun } from "@hugo-t-b/scriptor";
const declined = scriptor<Noun>("scriptor, scriptoris, m");
An optional options argument can be used to specify whether a third declension noun is i-stem (scriptor
can only automatically detect some neuter i-stems).
import scriptor from "@hugo-t-b/scriptor";
const declined = scriptor("ars, artis, f", {
iStem: true
});
console.log(declined.genitive.plural); //=> "artium"
To correctly decline/conjugate words that are generally regular with some irregular forms, the overrides
option can be used. Forms that are not specified in overrides
will not change.
import scriptor from "@hugo-t-b/scriptor";
const conjugated = scriptor("duco, ducere, duxi, ductus", {
overrides: { imperative: { active: { present: { singular: { second: "duc" } } } } }
});
console.log(conjugated.imperative.active.present.singular.second); //=> "duc"
console.log(conjugated.imperative.active.present.plural.second); //=> "ducite"
For words with irregular principle parts, use the creator function for the specific part of speech. The principal parts must be passed as an array without macrons. Many of the returned forms will be incorrect, however the overrides
option can be used to increase their accuracy.
import createVerb from "@hugo-t-b/scriptor/verbs";
const conjugated = createVerb([ "sum", "esse", "fui" ]);
Some of the forms that scriptor
returns are the principal parts of a distinct derived word (e.g., participles, comparative and superlative adjectives, etc.). To access specific forms of these words, they must be passed back to scriptor
.
import scriptor from "@hugo-t-b/scriptor";
const conjugated = scriptor("scribo, scribere, scripsi, scriptus");
const ppp = conjugated.participle.passive.perfect;
console.log(ppp); //=> "scriptus, scripta, scriptum"
const declinedPPP = scriptor(ppp);
const nomMascSg = declinedPPP.nominative.masculine.singular;
console.log(nomMascSg); //=> "scriptus"
import scriptor, { type Noun } from "@hugo-t-b/scriptor";
const greet = (name: string) => {
const declinedName = scriptor<Noun>(name);
const vocative = declinedName.vocative?.singular;
return `salve, ${vocative}!`;
}
console.log(greet("Gaius, Gaii, m")); //=> "salve, Gai!"
console.log(greet("Metella, Metellae, f")); //=> "salve, Metella!"
console.log(greet("Marcus, Marci, m")); //=> "salve, Marce!"
import scriptor, { type Adjective } from "@hugo-t-b/scriptor";
const makeMotto = (...qualities: string[]) => {
return qualities
.map(principalParts => scriptor<Adjective>(principalParts).comparative!)
.map(comparative => scriptor<Adjective>(comparative).nominative?.neuter?.singular!)
.join(", ");
};
console.log(makeMotto("citus, cita, citum", "altus, alta, altum", "fortis, forte"));
//=> "citius, altius, fortius" (faster, higher, stronger)
console.log(makeMotto("callidus, callida, callidum", "sapiens, sapientis", "prudens, prudentis"));
//=> "callidius, sapientius, prudentius" (smarter, wiser, more prudent)
- Nominative singular
- Genitive singular
- Gender (
m
,f
orn
)
1st | 2nd | 3rd | 4th | 5th | |
---|---|---|---|---|---|
Masc./fem. | β | β | β | β | β |
Neuter | π« | β | β | β | π« |
Nominative | Vocative | Accusative | Genitive | Dative | Ablative |
---|---|---|---|---|---|
β | β | β | β | β | β |
- Present active indicative first person singular
- Present active infinitive
- Perfect active indicative first person singular
- Perfect passive participle nominative masculine singular (optional)
Warning
A verb's supine is not supported as the 4th principal part. Always use its perfect passive participle instead.
1st | 2nd | 3rd | 3rd (-io) | 4th |
---|---|---|---|---|
β | β | β | β | β |
Present | Imperfect | Future | Perfect | Pluperfect | Future perfect | |
---|---|---|---|---|---|---|
Active | β | β | β | β | β | β |
Passive | β | β | β | β | β | β |
Present | Imperfect | Perfect | Pluperfect | |
---|---|---|---|---|
Active | β | β | β | β |
Passive | β | β | β | β |
Present | Future | |
---|---|---|
Active | β | β |
Passive | β | β |
Present | Perfect | Future | |
---|---|---|---|
Active | β | β | β |
Passive | β | β | β |
Present | Perfect | Future | |
---|---|---|---|
Active | β | π« | β |
Passive | π« | β | β |
The principal parts of an adjective vary based on the pattern it follows. The following examples are all valid:
- bonus, bona, bonum
- fortis, forte
- ingens, ingentis
- celer, celeris, celere
Nominative | Vocative | Accusative | Genitive | Dative | Ablative | |
---|---|---|---|---|---|---|
Masculine | β | β | β | β | β | β |
Feminine | β | β | β | β | β | β |
Neuter | β | β | β | β | β | β |
Positive | Comparative | Superlative | Adverb |
---|---|---|---|
β | β | β | β |
The only principal part for an adverb is its positive (normal) form.
Positive | Comparative | Superlative |
---|---|---|
β | β | β |