I liked your old version better here. I think isUpperCase on v1-train only detects Latin-1 capital letters and breaks in Polish. So please go back to word[0].toUpperCase === word[0]