mlmihjaz commited on
Commit
021d176
·
1 Parent(s): fec2039

Filter abbreviations (FAQ, RSS, JAN, FEB, SEP...) from the wordlist

Browse files

The dwyl 370k list contains acronyms and short-form abbreviations that
appear as 3-letter "words" and confuse learners (especially Tamil-medium
students). Curated blocklist drops months, weekdays, tech acronyms,
business titles, and country codes. Real words that look like
abbreviations (may, sun, sat, wed, mar) are kept intentionally.

Files changed (1) hide show
  1. src/game/Dictionary.js +24 -0
src/game/Dictionary.js CHANGED
@@ -15,6 +15,29 @@ const REAL_2L = new Set([
15
  'me','my','no','of','oh','ok','on','or','ox','so','to','up','us','we','ye',
16
  ]);
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  export class WordDictionary {
19
  constructor(words = []) {
20
  this.set = new Set();
@@ -29,6 +52,7 @@ export class WordDictionary {
29
  if (!w || !/^[a-z]+$/.test(w) || this.set.has(w)) continue;
30
  if (w.length === 1 && !REAL_1L.has(w)) continue;
31
  if (w.length === 2 && !REAL_2L.has(w)) continue;
 
32
  this.set.add(w);
33
  if (!this.byLen.has(w.length)) this.byLen.set(w.length, []);
34
  this.byLen.get(w.length).push(w);
 
15
  'me','my','no','of','oh','ok','on','or','ox','so','to','up','us','we','ye',
16
  ]);
17
 
18
+ // Abbreviations that leak in from the dwyl 370k wordlist and confuse learners,
19
+ // especially Tamil-medium students. Real words that happen to look like
20
+ // abbreviations (may, sun, sat, wed, mar) are intentionally kept.
21
+ const ABBREV_BLOCK = new Set([
22
+ // months
23
+ 'jan','feb','apr','jun','jul','aug','sep','sept','oct','nov','dec',
24
+ // weekdays
25
+ 'mon','tue','tues','thu','thur','thurs','fri',
26
+ // tech / web
27
+ 'faq','rss','url','uri','css','sql','php','ftp','dns','ssh','gui','api',
28
+ 'sdk','ide','cpu','gpu','ram','rom','usb','dvd','cd','mp3','mp4','pdf',
29
+ 'gif','jpg','jpeg','png','svg','xml','json','html','htm','http','https',
30
+ 'tcp','udp','smtp','imap','wifi','vpn','lan','wan','iot','aws','gcp',
31
+ // org / business
32
+ 'ceo','cfo','cto','coo','cmo','vip','llc','inc','ltd','plc','hq','hr','pr',
33
+ // country / region codes
34
+ 'usa','uae','uk','eu','un','nato','asean',
35
+ // misc abbreviations
36
+ 'etc','esp','vs','approx','dept','govt','dr','mr','mrs','ms','jr','sr',
37
+ 'mph','kph','rpm','psi','gpa','iq','tv','dj','tba','tbd','asap','diy',
38
+ 'lol','omg','btw','fyi','aka',
39
+ ]);
40
+
41
  export class WordDictionary {
42
  constructor(words = []) {
43
  this.set = new Set();
 
52
  if (!w || !/^[a-z]+$/.test(w) || this.set.has(w)) continue;
53
  if (w.length === 1 && !REAL_1L.has(w)) continue;
54
  if (w.length === 2 && !REAL_2L.has(w)) continue;
55
+ if (ABBREV_BLOCK.has(w)) continue;
56
  this.set.add(w);
57
  if (!this.byLen.has(w.length)) this.byLen.set(w.length, []);
58
  this.byLen.get(w.length).push(w);