Skip to content

Instantly share code, notes, and snippets.

@baltpeter
Last active August 29, 2015 14:08
Show Gist options
  • Save baltpeter/058b55099cf3062d8890 to your computer and use it in GitHub Desktop.
Save baltpeter/058b55099cf3062d8890 to your computer and use it in GitHub Desktop.
Given a plain text wordlist, output all words from that list that are nouns
var Treetagger = require('treetagger');
var tagger = new Treetagger({ language: "french" });
var fs = require('fs'), filename = "/Users/benni/coding/tt-nodejs/french.txt";
fs.readFile(filename, 'utf8', function(err, data) {
if(err) throw err;
tagger.tag(data, function (err, results) {
results.forEach(function(e) {
if(e.pos == "NOM") {
console.log(e.t);
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment