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

0.1.4 • Public • Published

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

Package Sidebar

Install

npm i dawgjs

Weekly Downloads

0

Version

0.1.4

License

MIT

Unpacked Size

24.6 kB

Total Files

27

Last publish

Collaborators

  • msklvsk