Closed molinto closed 8 years ago
Tried (but failing):
"retext-visit": "git://github.com/wooorm/retext-visit/tree/4fd0c018175b2a5c387c76d5cabcfc5c2c70c455"
"retext-visit": "git://https://github.com/wooorm/retext-visit/tree/4fd0c018175b2a5c387c76d5cabcfc5c2c70c455.zip"
"retext-visit": "https://github.com/wooorm/retext-visit/archive/4fd0c018175b2a5c387c76d5cabcfc5c2c70c455.tar.gz"
You can specify retext-visit@0.2.5
in your package.json
file. This will not show a deprecation message.
If that doesn’t work, could you show me your package.json
file, the command you execute to install, and the output you get?
Works now using:
"retext-visit": "https://github.com/wooorm/retext-visit/archive/4fd0c018175b2a5c387c76d5cabcfc5c2c70c455.tar.gz",
Another error now lol:
/home/sharry/Development/Projects/bh/bh-contacts/node_modules/retext-visit/index.js:73
parentPrototype = TextOM.Parent.prototype;
^
TypeError: Cannot read property 'Parent' of undefined
at plugin (/home/sharry/Development/Projects/bh/bh-contacts/node_modules/retext-visit/index.js:73:29)
at Of.use (/home/sharry/Development/Projects/bh/bh-contacts/node_modules/retext/node_modules/unified/node_modules/attach-ware/index.js:120:21)
at Processor.use (/home/sharry/Development/Projects/bh/bh-contacts/node_modules/retext/node_modules/unified/index.js:111:23)
at Object.<anonymous> (/home/sharry/Development/Projects/bh/bh-contacts/index.js:31:23)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Only want the sentiment of a single sentence (comment):
Just using:
var Retext = require('retext'),
sentiment = require('retext-sentiment'),
visit = require('retext-visit');
var rt = new Retext().use(visit).use(sentiment);
Do I need to include others packages to use this module? Sorry, been a while since I used this.
function getCommentSentiment(comment, cb) {
rt.parse(comment, function (err, tree) {
if (err) {
return cb(err);
}
if (tree.length === 0) {
return cb(new Error('Error loading the comment data!'));
}
var sentiment;
tree.visit(tree.SENTENCE_NODE, function (node) {
sentiment = node.data.valence;
});
cb(null, tree, sentiment);
});
}
I’m guessing you’re on retext@1.0.0? The reason retext-visit
is deprecated is because everything changes in retext-land, meaning, retext-visit is no longer applicable because that’s no longer how retext works.
Either pin all your retext-dependencies down to before 1.0.0, or update to 1.0.0 and change your code.
Yep, v1.0.0
"dependencies": {
"amqplib": "^0.4.0",
"crypto-js": "^3.1.6",
"express": "^4.13.3",
"http": "0.0.0",
"lodash": "^3.10.1",
"moment": "^2.10.6",
"mongoose": "^4.1.10",
"mongoose-simple-random": "^0.3.3",
"mongoose-timestamp": "^0.4.0",
"random-id": "0.0.2",
"retext": "^1.0.0",
"retext-sentiment": "^1.0.0",
"retext-visit": "https://github.com/wooorm/retext-visit/archive/4fd0c018175b2a5c387c76d5cabcfc5c2c70c455.tar.gz",
"validator": "^4.1.0",
"when": "^3.7.3",
"winston": "^2.1.1",
"winston-loggly": "^1.2.0"
}
Then, either update your code, or downgrade the version numbers to 0.6.0
, 0.4.2
, 0.2.5
, respectively.
Thanks, think I'll have to move to another module as all existing code/examples build use rt.parse() which doesn't exist anymore. Thanks anyway dude
:+1:
Hi Titus, we still use this package. How do I still use in Package.json please?
Sharry