https://github.com/maroun-baydoun/de-noun-parser
Parse Wikitext's de-noun template
https://github.com/maroun-baydoun/de-noun-parser
german typescript wikipedia wikitext
Last synced: 3 months ago
JSON representation
Parse Wikitext's de-noun template
- Host: GitHub
- URL: https://github.com/maroun-baydoun/de-noun-parser
- Owner: maroun-baydoun
- License: mit
- Created: 2019-02-11T20:36:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-15T14:13:40.000Z (over 1 year ago)
- Last Synced: 2025-03-12T07:32:25.394Z (3 months ago)
- Topics: german, typescript, wikipedia, wikitext
- Language: TypeScript
- Homepage: https://dev.maroun-baydoun.com/de-noun-parser/
- Size: 933 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## de-noun-parser
##### Parse Wikitext's de-noun template[](https://badge.fury.io/js/de-noun-parser)
### Install
```
npm i de-noun-parser
```
Or```
yarn add de-noun-parser
```### Usage
``` ts
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](https://dev.maroun-baydoun.com/de-noun-parser/#demo).
### About de-noun template
[Template:de-noun documentation](https://en.wiktionary.org/wiki/Template:de-noun)