fixed words extraction

main
Inga 🏳‍🌈 12 months ago
parent 2f059aa3f0
commit ea48bfa630
  1. 10
      src/build-scripts/oooThesaurusParser.test.ts
  2. 2
      src/build-scripts/oooThesaurusParser.ts

@ -7,5 +7,13 @@ void t.test('extractWordsFromFile', async (t) => {
new URL('../../build-resources/th-en-x-basic.dat', import.meta.url),
);
//console.log(words);
t.equal(words.length, 12371);
t.equal(words.length, 24691);
t.equal(words.includes('afterthought'), true);
t.equal(words.includes('airplane'), true);
t.equal(words.includes('another'), true);
t.equal(words.includes('anybody'), true);
t.equal(words.includes('anyhow'), true);
t.equal(words.includes('anyone'), true);
t.equal(words.includes('anything'), true);
t.equal(words.includes('anywhere'), true);
});

@ -29,7 +29,7 @@ const extractWordsFromThesaurus = (thesaurus: string): string[] => {
chunks
.filter((chunk) => chunk.length)
.map((chunk) => chunk[0]?.split('|')?.[0]),
).filter(WORD_REGEX.test.bind(WORD_REGEX));
).filter((maybeWord) => !!maybeWord.match(WORD_REGEX));
};
export const extractWordsFromFile = async (

Loading…
Cancel
Save