fix browser loading node code
This commit is contained in:
parent
39fba2e7f0
commit
b0909b8551
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "wordpos",
|
"name": "wordpos",
|
||||||
"version": "2.0.0-alpha",
|
"version": "2.0.0-alpha",
|
||||||
"description": "wordpos is a set of part-of-speech utilities for Node.js using the WordNet database.",
|
"description": "wordpos is a set of part-of-speech utilities for Node.js & browser using the WordNet database.",
|
||||||
"author": "Moos <mooster@42at.com>",
|
"author": "Moos <mooster@42at.com>",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"natural",
|
"natural",
|
||||||
|
@ -27,9 +27,9 @@
|
||||||
"bin": "./bin/wordpos-cli.js",
|
"bin": "./bin/wordpos-cli.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"commander": "^2.0.0",
|
"commander": "^2.0.0",
|
||||||
"dict": "^1.4.0",
|
|
||||||
"underscore": ">=1.3.1",
|
"underscore": ">=1.3.1",
|
||||||
"wordnet-db": "^3.1.6"
|
"wordnet-db": "^3.1.6",
|
||||||
|
"symlink-dir": "1.1.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
|
@ -44,11 +44,15 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/moos/wordpos.git"
|
"url": "git://github.com/moos/wordpos.git"
|
||||||
},
|
},
|
||||||
"main": "./src/wordpos.js",
|
"main": "./src/node/index.js",
|
||||||
|
"browser": "./src/browser/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "node tools/stat.js --no-stats index.adv index.adj index.verb index.noun",
|
"postinstall": "npm run postinstall-web && npm run postinstall-node",
|
||||||
|
"postinstall-node": "node tools/stat.js --no-stats index.adv index.adj index.verb index.noun",
|
||||||
"postinstall-web": "node scripts/makeJsonDict.js index data",
|
"postinstall-web": "node scripts/makeJsonDict.js index data",
|
||||||
"test": "mocha test",
|
"test": "mocha test",
|
||||||
|
"test-browser": "mocha test- # TODO",
|
||||||
|
"prestart": "mkdir dist && symlink-dir dict dist/dict && cp samples/self-hosted/main.js dist/main.txt",
|
||||||
"start": "npm run start-self",
|
"start": "npm run start-self",
|
||||||
"start-self": "parcel samples/self-hosted/index.html",
|
"start-self": "parcel samples/self-hosted/index.html",
|
||||||
"start-cdn": "parcel samples/cdn/index.html"
|
"start-cdn": "parcel samples/cdn/index.html"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import WordPOS from '../../src/wordpos';
|
import WordPOS from '../../src/browser/index';
|
||||||
|
|
||||||
console.log(__dirname, WordPOS.defaults)
|
console.log('WordPOS.defaults:', WordPOS.defaults);
|
||||||
|
|
||||||
let wordpos = window.wordpos = new WordPOS({
|
let wordpos = window.wordpos = new WordPOS({
|
||||||
// preload: true,
|
// preload: true,
|
||||||
|
@ -22,7 +22,7 @@ wordpos.isAdverb('likely', (res, ...profile) => console.log('callback with profi
|
||||||
wordpos.getAdverbs('this is is lately a likely tricky business this is')
|
wordpos.getAdverbs('this is is lately a likely tricky business this is')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('getAdverbs:', res);
|
console.log('getAdverbs:', res);
|
||||||
console.assert(res[0] === 'lately');
|
console.assert(res[0] === 'lately'); // NOTE: order is NOT gauranteed!
|
||||||
console.assert(res[1] === 'likely');
|
console.assert(res[1] === 'likely');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ wordpos.lookupAdverb('likely')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('lookupAdverb:', res);
|
console.log('lookupAdverb:', res);
|
||||||
assertLikely(res[0]);
|
assertLikely(res[0]);
|
||||||
|
|
||||||
});
|
});
|
||||||
// wordpos.lookup('likely').then(res, console.log('lookup ===', res))
|
// wordpos.lookup('likely').then(res, console.log('lookup ===', res))
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
main.js
|
|
Loading…
Reference in New Issue