german-words
TypeScript icon, indicating that this package has built-in type declarations

5.3.0 • Public • Published

German Words

Provides information on German words:

  • Gender of German words, : Korpus is neutral, Friede is masculine, etc.
  • Case declination of words: the genitive of Herr is Herren.

Use german-words-dict as the linguistic resource.

Installation

npm install german-words

Usage

const GermanWords = require('german-words');
const GermanWordsList = require('german-words-dict/dist/words.json');

// F
console.log(GermanWords.getGenderGermanWord(null, GermanWordsList, 'Gurke'));

// Herren
console.log(GermanWords.getCaseGermanWord(null, GermanWordsList, 'Herr', 'GENITIVE', 'S'));

// Gurken
console.log(GermanWords.getCaseGermanWord(null, GermanWordsList, 'Gurke', 'NOMINATIVE', 'P'));

getGenderGermanWord returns the gender M F or N, based on:

  • a exception linguistic resource (put null in general, only use it to override standard linguistic resource)
  • a linguistic resource (see german-words-dict)
  • the word at its root form

getCaseGermanWord returns the declined word based on:

  • a linguistic resource (see german-words-dict)
  • first string param which is the word at its root form
  • second string param which is the case (NOMINATIVE ACCUSATIVE DATIVE GENITIVE)
  • third string param which is the number (S or P)

Both throw an error when the word is not found.

Readme

Keywords

Package Sidebar

Install

npm i german-words

Weekly Downloads

342

Version

5.3.0

License

Apache-2.0

Unpacked Size

20.3 kB

Total Files

6

Last publish

Collaborators

  • ludan.stoeckle