msklvsk / dawgjs Goto Github PK
View Code? Open in Web Editor NEWDAWG reader for node.js and the browser
License: MIT License
DAWG reader for node.js and the browser
License: MIT License
from pprint import pprint
import dawg
words = [ u'ABC', u'ABCD', u'ABCS', u'АБВ', u'АБВГ', u'АБВЦ' ]
d = dawg.CompletionDAWG(words)
d.save('../data/words.dawg')
print(d.keys("ABC"))
print(d.keys("АБ"))
# Output:
# ['ABC', 'ABCD', 'ABCS']
# ['АБВ', 'АБВГ', 'АБВЦ']
Готовый словарь: words.dawg.zip
import {readStringMapDawgSync} from "dawgjs";
let dawg = readStringMapDawgSync('../../data/words.dawg', bytes => {
let view = new DataView(bytes.buffer);
return {
paradigmId: view.getUint16(0, true),
indexInParadigm: view.getUint8(2)
};
});
console.log(dawg.get("АБВ"));
./dawg/dawgjs-sample/node_modules/dawgjs/factories.js:13
let dictData = new Uint32Array(buffer, 4, dictSize);
^
RangeError: Invalid typed array length
at new Uint32Array (native)
at readByteCompletionDawg (./dawg/dawgjs-sample/node_modules/dawgjs/factories.js:13:20)
at Object.readStringMapDawg (./dawg/dawgjs-sample/node_modules/dawgjs/factories.js:27:55)
at Object.readStringMapDawgSync (./dawg/dawgjs-sample/node_modules/dawgjs/factories.node.js:6:24)
at Object.<anonymous> (./dawg/dawgjs-sample/index.js:3:21)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
$ node --version
v6.9.1
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.2
$ python3 --version
Python 3.6.0
$ pip3 list
DAWG (0.7.8)
Can you please update the code on Github. Because as I see the version on npm higher.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.