[Improvement]: Government of #Country - Rule
MarketingPip opened this issue · comments
Jared Van Valkengoed commented
Again - another rule kit.
/**
* Extracts government of country from a given text.
*
* @param {string} str - The input text to analyze.
* @returns {string|false} - The extracted government name or false if no match is found.
*/
function governmentOfRule(str) {
// Create an NLP document from the input text
let doc = nlp(str);
// Check for patterns like "government of Canada" or "government of the united states"
let match = doc.match("government (of the|of) (#Country+|#Country)");
if (match.found) {
return match.out("text");
}
return false; // Return null if no bank names is found
}
console.log(governmentOfRule("government of india"))
spencer kelly commented
this works for /postTagger/model/orgs
too - I would write it government of the? #Country+
cheers
Jared Van Valkengoed commented
@spencermountain - if you wanna add the changes your more than welcome. If you want me too - also more than welcome. Wanted approval before messing with anything - since I thought I f*cked up kinda with the university rule after seeing where you moved it & you had something commented out similar in it.
But no hurt feelings if you get to this before me. 👍
Jared Van Valkengoed commented
Closed as seeing you have added this in.