diff --git a/README.md b/README.md index 7b9840a..199f211 100644 --- a/README.md +++ b/README.md @@ -289,6 +289,9 @@ See [bench/README](bench). ## Changes +1.1.3 + - temporary fix for #19 issue with npm@5 + 1.1.2 - Fix DeprecationWarning for node 7.x (1.1.1) - Fix occasional error for large offsets during seek diff --git a/package.json b/package.json index 5cf2798..c5c731f 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,7 @@ { "name": "wordpos", + "version": "1.1.3", + "description": "wordpos is a set of part-of-speech utilities for Node.js using the WordNet database.", "author": "Moos ", "keywords": [ "natural", @@ -10,8 +12,6 @@ "adverbs", "verbs" ], - "description": "wordpos is a set of part-of-speech utilities for Node.js using the WordNet database.", - "version": "1.1.2", "homepage": "https://github.com/moos/wordpos", "engines": { "node": ">=0.12" diff --git a/tools/stat.js b/tools/stat.js index e045ae7..25fcd69 100644 --- a/tools/stat.js +++ b/tools/stat.js @@ -40,18 +40,43 @@ * read index file between the two offsets * binary search read data O(log avg) * - * Copyright (c) 2012-2016 mooster@42at.com + * Copyright (c) 2012-2017 mooster@42at.com * https://github.com/moos/wordpos * * Released under MIT license */ + +var + fs = require('fs'), + path = require('path'), + dictPath = path.resolve(__dirname, '..', 'node_modules', 'wordnet-db', 'dict'); + + +// TEMP fix for https://github.com/moos/wordpos/issues/19 +// Ensure /dict file before continuing +var timer = setInterval(check, 750); +var tries = 10; +process.stdout.write('checking ' + dictPath); +function check() { + if (fs.existsSync(dictPath)) { + clearInterval(timer); + process.stdout.write(' ready\n'); + main(); + } else if (--tries <= 0) { + console.log('\n%s not ready -- see https://github.com/moos/wordpos/issues/19. Abandoning!', dictPath) + process.exit(1); + } + process.stdout.write(' ' + tries); +} + + +function main() { + var WNdb = require('../src/wordpos').WNdb, util = require('util'), BufferedReader = require ('./buffered-reader'), _ = require('underscore')._, - fs = require('fs'), - path = require('path'), KEY_LENGTH = 3, stats = true, eofKey = '_EOF_'; // should be unique @@ -62,6 +87,7 @@ if (process.argv.length < 3) { process.exit(1); } + _(process.argv.slice(2)).filter(function(arg){ // disable writing stats file if (arg == '--no-stats') { @@ -153,3 +179,5 @@ _(process.argv.slice(2)).filter(function(arg){ }) .read(); }); + +} \ No newline at end of file