Skip to content

maroun-baydoun/de-noun-parser

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

de-noun-parser

Parse Wikitext's de-noun template

npm version

Install

npm i de-noun-parser 

Or

yarn add de-noun-parser 

Usage

import parse from 'de-noun-parser';

const wikitext = '...';
const parsed = parse(wikitext);

Parse result

Field Type Note
gender string m or f or n
plural string If -en, the plural form should default to the word + -en
genetive string | null If -s, the genetive form should default to the word + s. If null, the genetive form should default to the word itself
diminutive string? The diminutive form of the noun, or undefined when not applicable
genderedForm string? The feminine form of a masculine noun, the masculine form of a feminine noun, or undefined when not applicable
template { text: string, arguments: string, startIndex: number, endIndex: number } The template's full text, its arguments and its start and end indexes within the provided wikitext

If the parsing is not successful, a subclass of ParsingError is thrown.

Demo

Try the demo here.

About de-noun template

Template:de-noun documentation