Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement]: Bank of #Place - Rule. #1039

Open
MarketingPip opened this issue Sep 13, 2023 · 1 comment
Open

[Improvement]: Bank of #Place - Rule. #1039

MarketingPip opened this issue Sep 13, 2023 · 1 comment

Comments

@MarketingPip
Copy link
Contributor

Another rule kit - for things like "Bank of Canada".

/**
 * Extracts Bank of #Place from a given text.
 *
 * @param {string} str - The input text to analyze.
 * @returns {string|false} - The extracted bank name or false if no match is found.
 */

function bankOfRule(str) {
  // Create an NLP document from the input text
  let doc = nlp(str);
  
  // Check for patterns like "the national bank of Canada"
  let match = doc.match("(international|national) bank of (#Place+|#Place)");
  if (match.found) {
    return match.out("text");
  }
  
  
    // Check for patterns like "bank of Canada"
   match = doc.match("bank of (#Place+|#Place)");
  if (match.found) {
    return match.out("text");
  }


  return false; // Return null if no bank names is found
}
@spencermountain
Copy link
Owner

good idea - 'bank' is already in orgwords but bank of #Place+ is a good candidate for ./postTagger/model/orgs is you wanted to add it - (the + matches one or more matches)
cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants