0
我試圖通過參考https://www.npmjs.org/package/treetagger來運行treetagger,但我得到了下面的錯誤。如何在Node.js中使用Treetagger進行形態分析
TypeError: Object function TreeTagger(options) {
events.EventEmitter.call(this);
this.options = options || {};
this.encoding = this.options.encoding || 'latin-1';
this.language = this.options.language || 'english';
this.paths = ['.', '/usr/bin', '/usr/local/bin', '/opt/local/bin',
'/Applications/bin', '~/bin', '~/Applications/bin'];
this.envVars = ["TREETAGGER", "TREETAGGER_HOME"];
// Validate the given encoding and language selected
if (!this.encoding in languages) {
throw new Error("Unsupported encoding detected " + this.encoding);
}
if (languages[this.encoding].indexOf(this.language) < 0) {
throw new Error("Unsupported language detected " + this.language + " for encoding " + this.encoding);
}
// Set the appropriate bin path
if (this.encoding == "latin-1") {
this.binPath = 'tree-tagger-' + this.language;
}
else {
this.binPath = 'tree-tagger-' + this.language + '-' + this.encoding;
}
this.binPath = findPath(this.binPath, this.paths, this.envVars);
} has no method 'tag'
謝謝。我解決了。 – sakihiro 2014-10-08 02:39:31
@sakihiro不要忘記驗證答案:) – FGRibreau 2014-10-08 07:02:26
我不知道如何驗證。請教我驗證 – sakihiro 2014-10-23 01:45:34