Closed balavenkatesh3322 closed 4 years ago
Hi @balavenkatesh3322, a "sample js file" as you say wouldn't be enough, since you also need to download the model following the steps described in the readme:
npm install question-answering@latest
npx question-answering download
js
file with the code you provided, and run node myfile.js
. It should log { text: 'Denver Broncos', score: 0.3 }
.Just pay attention to the first line of the code, if you're using plain vanilla JS (no Typescript or Babel), you should replace import { QAClient } from "question-answering";
by const { QAClient } = require("question-answering");
(I just updated the readme accordingly).
Hi @Pierrci , Thanks for your explanation and an updated readme file.
As you said I created file and I got below error while running this command node myfile.js
internal/modules/cjs/loader.js:807
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: /home/bala/Documents/aibots/pdf project/node_modules/tokenizers/bin-package/index.node: undefined symbol: _ZN2v82V818GlobalizeReferenceEPNS_8internal7IsolateEPm
at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/bala/Documents/aibots/pdf project/node_modules/tokenizers/bindings/native.js:1:16)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
I have attached screenshot for your reference.
Can you try replacing the line in error (line 3) with the following:
const { QAClient } = require("question-answering");
It seems that although you're running vanilla js, you used some typescript code to import QAClient
.
How can I run this code to test this project?
Do you have a sample js file to test this library?