Giter Site home page Giter Site logo

dawgjs's People

Contributors

msklvsk avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

bt2901

dawgjs's Issues

RangeError: Invalid typed array length

Построение словаря:

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

Инициализация словая в JS:

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.