Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Creation of ig.js for Igbo validation #503

Closed
chrisemezue opened this issue Oct 29, 2021 · 3 comments
Closed

Creation of ig.js for Igbo validation #503

chrisemezue opened this issue Oct 29, 2021 · 3 comments
Labels

Comments

@chrisemezue
Copy link
Contributor

chrisemezue commented Oct 29, 2021

@MichaelKohler
We need to add rules for igbo here

these are changes i propose (tweaking the en.js)

const tokenizeWords = require('talisman/tokenizers/words');

// Minimum of words that qualify as a sentence.
const MIN_WORDS = 1;

// Maximum of words allowed per sentence to keep recordings in a manageable duration.
const MAX_WORDS = 16;

const INVALIDATIONS = [{
  fn: (sentence) => {
    const words = tokenizeWords(sentence);
    return words.length < MIN_WORDS || words.length > MAX_WORDS;
  },
  error: `Number of words must be between ${MIN_WORDS} and ${MAX_WORDS} (inclusive)`,
}, {
  regex: /[0-9]+/,
  error: 'Sentence should not contain numbers',
}, {
  regex: /[<>+*#@^[\]()/]/,
  error: 'Sentence should not contain symbols',
}, {
  // Any words consisting of uppercase letters or uppercase letters with a period
  // inbetween are considered abbreviations or acronyms.
  // This currently also matches fooBAR but we most probably don't want that either
  // as users wouldn't know how to pronounce the uppercase letters.
  regex: /[A-Z]{2,}|[A-Z]+\.*[A-Z]+/,
  error: 'Sentence should not contain abbreviations',
}];

module.exports = {
  INVALIDATIONS,
};
@MichaelKohler
Copy link
Member

When you asked about it I was under the impression that you will need help implementing it. Happy to see you figured it out. In that case I would suggest you create a Pull Request with those suggestions if you want to :)

@MichaelKohler
Copy link
Member

@chrisemezue do you need help creating the Pull Request or do you want me to implement it like you suggested?

MichaelKohler pushed a commit that referenced this issue Nov 7, 2021
## [2.12.3](v2.12.2...v2.12.3) (2021-11-07)

### Bug Fixes

* adding rules for Igbo (fixes [#503](#503)) ([#529](#529)) ([170916a](170916a))
@MichaelKohler
Copy link
Member

🎉 This issue has been resolved in version 2.12.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

No branches or pull requests

2 participants