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

    4.0.1 • 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.

    Install

    npm i german-words

    DownloadsWeekly Downloads

    1,286

    Version

    4.0.1

    License

    Apache-2.0

    Unpacked Size

    20.2 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar