This repository has been archived by the owner on May 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const tokenizeWords = require('talisman/tokenizers/words'); | ||
|
||
// Minimum of words that qualify as a sentence. | ||
const MIN_WORDS = 3; | ||
|
||
// Maximum of words allowed per sentence to keep recordings in a manageable duration. | ||
const MAX_WORDS = 15; | ||
|
||
const INVALIDATIONS = [{ | ||
fn: (sentence) => { | ||
const words = tokenizeWords(sentence); | ||
return words.length < MIN_WORDS || words.length > MAX_WORDS; | ||
}, | ||
error: `በአረፍተነገሩ ውስጥ ያለው የቃላት ቁጥር በ ${MIN_WORDS} እና ${MAX_WORDS} መሆን አለበት (የሚጠቃለል)`, | ||
}, { | ||
regex: /[0-9]+ | [\u1369-\u137C]+/, | ||
error: 'አረፍተነገሩ ውስጥ ቁጥር ሊኖር አይገባም ወይም ቁጥሩን በአማርኛ ተርጉመው ያስተካክሉት ወይም አዲስ አረፍተነገር ይጨምሩ እባክዎ።', | ||
},{ | ||
regex: /[A-Za-z]+/, | ||
error: 'አረፍተነገሩ ውስጥ በእንግሊዘኛ ፊደል የተጻፈ ነገር ካለ እባክዎ ይተርጉሙት ወይም ያስወግዱት', | ||
}, { | ||
regex: /[\u1360-\u1368]+ | [<>+*#@%^[\]()/]/, | ||
error: 'አረፍተነገሩ ውስጥ የተለዩ ምልክቶች እንደ ነጠላ ሰረዝ፣ ድርብ ሰረዝ፣ የዶላር ምልክት እና ሌሎችም ሊኖሩ አይገባም እባክዎ ያስተካክሉት ወይም አዲስ አረፍተነገር ይጨምሩ።', | ||
}, { | ||
// 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: /[\u1200-\u1357]+\.*[\u1200-\u1357]+/, | ||
error: 'አረፍተነገሩ ውስጥ ምህጻረ ቃላት ካሉ ያስወግዱት እባክዎ', | ||
}]; | ||
|
||
module.exports = { | ||
INVALIDATIONS, | ||
}; |