0.1.4 • Published 6 years ago

dawgjs v0.1.4

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

dawgjs reads DAWG files created by dawgdic C++ library or DAWG python package.

DAWG (directed acyclic word graph, also called DAFSA) is a data structure that lets you efficiently store sets of strings and also provides prefix search.

Installation

npm install dawgjs

Usage

typescript

import { readStringMapDawgSync } from 'dawgjs'

let dawg = readStringMapDawgSync('dawg-file.dawg', bytes => {
  let view = new DataView(bytes.buffer)
  return {
    paradigmId: view.getUint16(0, true),
    indexInParadigm: view.getUint8(2)
  }
})

let morphologicalInterpretations = [...dawg.get('pierogi')]

es6

// todo

Current limitations

  • This package cannot create DAWGs.
  • Targeting ES6. Additional transpilation required from you to target ES5/ES3.

Contribution

Questions, feature requests, ideas, bugs and PRs are always welcomed on github.

Development

git clone https://github.com/msklvsk/dawgjs.git
cd dawgjs
npm install
npm run build:watch