You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I am new to working with this API, I am wondering the best practices with starting from a document and working through sentences.
Suggestions for enhancing the following code and links to any examples would be much appreciated!
// 2017-11-25 learning corenlp v1.1.8// The coreNLP server is a Docker image mapped to port 9000require("babel-polyfill");// Need this polyfill even if you are not using async/await.// I received this error in both node.js 7.8.0 and node.js 8.5.0://------ /Users/owendall/Desktop/github-applications/ai/core-nlp-test/node_modules/corenlp/dist/pipeline.js:139//----- var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(annotable) {//----- ReferenceError: regeneratorRuntime is not definedconstcorenlp=require("corenlp");constcoreNLP=corenlp.default;// convenient when not using `import`constconnector=newcorenlp.ConnectorServer({dsn: 'http://localhost:9000',});// initialize the pipeline and document to annotateconstprops=newcorenlp.Properties({annotators: 'ssplit,tokenize,pos,ner,parse'});constpipeline=newcorenlp.Pipeline(props,'English',connector);console.log("Pipeline Details: ",JSON.stringify(pipeline,null,2));// Let's look at the internalsconstdoc=newcoreNLP.simple.Document('I live on the river, close to the river bank. I had an old boat on the river. I used the boat on the river every day.');console.log(JSON.stringify(doc,null,2));pipeline.annotate(doc).then(function(doc){varsentenceArray=doc.sentences();console.log("Found "+sentenceArray.length+" sentences");console.log("sentenceArray: ",JSON.stringify(sentenceArray,null,2));sentenceArray.map(function(sentence){console.log("Sentence: ",sentence)});}).catch(function(err){console.log('err',err);});
The text was updated successfully, but these errors were encountered:
@owendall Here's an example of how it could be done.
const doc = new CoreNLP.simple.Document(I live on the river, close to the river bank. I had an old boat on the river. I used the boat on the river every day.);
Hi,
So glad to see a node interface to CoreNLP.
As I am new to working with this API, I am wondering the best practices with starting from a document and working through sentences.
Suggestions for enhancing the following code and links to any examples would be much appreciated!
The text was updated successfully, but these errors were encountered: