Skip to content

Instantly share code, notes, and snippets.

@josue1dario2
Last active November 6, 2023 14:08
Show Gist options
  • Save josue1dario2/9311385dbee147c3c094f062f37ccf57 to your computer and use it in GitHub Desktop.
Save josue1dario2/9311385dbee147c3c094f062f37ccf57 to your computer and use it in GitHub Desktop.
Test library compromise
const datos = require('./datos.json');
const nlp = require('compromise');
const expresionRegular = /(\d+\s*\"|\d+[A-Za-z]+|\d+\s*\w+|[A-Za-z]\d+|A54)/gi;
let lista = [];
datos.entry.map((obj, index) => {
if (index < 5) {
const doc = nlp(obj.title.__cdata);
doc.remove('#Determiner');
doc.remove('#Pronoun');
doc.remove('#Conjunction');
doc.remove('#Preposition');
const match = doc.text().match(expresionRegular);
if (match) {
lista.push(match);
}
}
});
console.log(lista);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment