Skip to content

Commit

Permalink
Readme: add usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
stscoundrel committed Feb 20, 2024
1 parent 2eee3fc commit cb5d978
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,39 @@ Old Danish Dictionary for Node.js. From Otto Kalkar's Dictionary of elder Danish

`yarn add old-danish-dictionary`

##### Usage
### Usage

The project provides a getter for the whole compressed dataset. You can use it in your script to populate your own database or otherwise use the data.

Should you want to use the data without this Node.js library, you might want to check [Old Danish Dictionary Builder](https://github.com/stscoundrel/old-danish-dictionary-builder).

```javascript
import { getDictionary } from 'old-danish-dictionary'

/**
* Whole dictionary as array
* contains over 45 000 entries.
*/
const dictionary = getDictionary()


// Filter words starting with letter T
const tWords = dictionary.filter((entry) => entry.word.charAt(0) === 't')

console.log(tWords)

```

Individual words are returned in format of:

```javascript
{
headword: string,
definitions: string[],
}
```

As in the printed book, some definitions are heavily abbreviated. You can map them back to their full meanings.

Find abbreviations used in the definitions.

Expand All @@ -25,9 +57,9 @@ console.log(result);
// "no." => "navneord (substantivum).",
// "æ." => "ældre.",


```


### About "Dictionary of the Old Danish Language"

_"Ordbog til det ældre danske Sprog"_ dictionary was published in late 1800s by Otto Kalkar. Old Danish is an ancestor language of Danish, which developed from Old East Norse, the eastern dialect of Old Norse, at the end of the Viking Age. The dictionary itself is called "the dictionary of elder Danish speech" and it covers time period of 1300 - 1700.
Expand Down

0 comments on commit cb5d978

Please sign in to comment.