Tweak words per second metric in the test page log

This commit is contained in:
Motin 2021-02-15 10:37:37 +02:00
parent d3969bcd2d
commit 28c0ab2e04

View File

@ -117,7 +117,7 @@ the sky is blue
const sentences = text.split("\n");
let wordCount = 0;
sentences.forEach(sentence => {
wordCount += sentence.trim().split(" ").length;
wordCount += sentence.trim().split(" ").filter(word => word.trim() !== "").length;
})
const start = Date.now();
const translatedSentences = translate(sentences);