From 90817f09d73ecc155fb39f60b9e4d0d7295542c7 Mon Sep 17 00:00:00 2001 From: Ijemma Onwuzulike Date: Wed, 18 Oct 2023 21:42:21 -0400 Subject: [PATCH] Update words.ts Ignores specific words that seem like English despite being Igbo --- src/controllers/words.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controllers/words.ts b/src/controllers/words.ts index cfaaa898..3a8728c2 100644 --- a/src/controllers/words.ts +++ b/src/controllers/words.ts @@ -18,6 +18,7 @@ import { Express, LegacyWord } from '../types'; import { WordResponseData } from './types'; const isEnglish = isWord('american-english'); +const IGNORE_ENGLISH_WORDS = ['ego']; /* Gets words from JSON dictionary */ export const getWordData: Express.MiddleWare = (req, res, next) => { @@ -60,7 +61,8 @@ const getWordsFromDatabase: Express.MiddleWare = async (req, res, next) => { filters, }; let responseData: WordResponseData = { words: [], contentLength: 0 }; - const isSearchWordEnglish = isEnglish.check(searchWord) && !!searchWord; + const isSearchWordEnglish = + isEnglish.check(searchWord) && !!searchWord && !IGNORE_ENGLISH_WORDS.includes(searchWord); if (hasQuotes || isSearchWordEnglish) { responseData = await searchWordUsingEnglish({ redisClient,