How to use the wtf_wikipedia.plaintext function in wtf_wikipedia

To help you get started, we’ve selected a few wtf_wikipedia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github populr-app / populr / server / workers / wikipedia.js View on Github external
function parseJob(markup) {

  // gets the first sentence in Wikipedia markup
  var sentence = WikipediaApi.plaintext(markup).split(/\. [A-Z]/)[0];

  // split after name and DOB
  var arr = sentence.split(' is ');
  arr.splice(0, 1);

  // get their job
  var job = arr.join(' is ').replace(/^a /, '').replace(/^an /, '').replace(/^the /, '');
  job = job.split(' who')[0];
  job = job.split(', where')[0];
  job = job.split(' from')[0];
  job = job.split('; ')[0];
  job = job.replace(/[,.:;!@#$%^&*()+ ]+$/, '');

  // if job description is over 90 characters, is probably bad.
  return job.length > 90 ? '' : job;
};
github nlp-compromise / nlp-corpus / wikipedia / build.js View on Github external
wtf_wikipedia.from_api(title, lang, function (markup) {
      let text = wtf_wikipedia.plaintext(markup) || '';
      let filename = __dirname + '/corpus/' + title + '.txt';
      fs.writeFileSync(filename, text, 'utf8')
      let mb = (fs.statSync(filename).size || 0) / 1000000.0;
      console.log(title + '  -  ' + mb.toFixed(2) + 'mb');
      cb(null, '');
    });
  };
github PranavMahesh1 / Modular-Node.js-IRC-Bot / modules / wikipedia.js View on Github external
wikipedia.from_api(args, "en", function(markup){
  				var text = wikipedia.plaintext(markup).substring(0,100) + "...";
				if (text != "...") {
					chan.say(text + " https://en.wikipedia.org/w/index.php?title=" + encodeURIComponent(args));
				} else {
					chan.say("No page found");
				}
			});
		} else {

wtf_wikipedia

parse wikiscript into json

MIT
Latest version published 3 months ago

Package Health Score

72 / 100
Full package analysis