You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Probably can be expanded and more than likely should be checking for "and" in next word. If match found - do not match. As we may miss full matches.
functionmuseumRule(str){// Create an NLP document from the input textletdoc=nlp(str);// Check for patterns like Scottish National Galleryletmatch=doc.match("(#Place+|#Place|#ProperNoun|#Noun) national (art museum|museum of arts|museum of art|museum of fine arts|museum of fine art|museum|art gallery|gallery|art institute)");if(match.found){returnmatch.out("text");}// Check for patterns like 'National Gallery of Ireland'match=doc.match("national (art museum|museum of arts|museum of art|museum of fine arts|museum of fine art|museum|art gallery|gallery) (of|in) (#Place+|#Place|#ProperNoun|#Noun)");if(match.found){returnmatch.out("text");}// Check for patterns like 'National Gallery Singapore'match=doc.match("national (art museum|museum of arts|museum of art|museum of fine arts|museum of fine art|museum|art gallery|gallery) (#Place+|#Place|#ProperNoun|#Noun)");if(match.found){returnmatch.out("text");}// Denver Art Museummatch=doc.match("(#Place+|#Place|#ProperNoun|#Noun) (art museum|museum of arts|museum of art|museum of fine arts|museum of fine art|museum|art gallery|art institute|gallery)");if(match.found){returnmatch.out("text");}// Check for patterns like 'Art Gallery of Ontario'match=doc.match("(art museum|art gallery|art institute|gallery) of (#Place+|#Place|#ProperNoun|#Noun)");if(match.found){returnmatch.out("text");}returnfalse;// Return null if no museum is found}
Basic tests:
console.log(museumRule("Denver Art Museum"))console.log(museumRule("Scottish National Gallery"))console.log(museumRule("National Museum of Scotland"))console.log(museumRule("National Museum in Krakow"))console.log(museumRule("national art gallery of canada"))
The text was updated successfully, but these errors were encountered:
Another rule set -
Probably can be expanded and more than likely should be checking for "and" in next word. If match found - do not match. As we may miss full matches.
Basic tests:
The text was updated successfully, but these errors were encountered: