mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-27 10:31:22 +08:00
Fix tokenizer (#2652)
This commit is contained in:
parent
244b35e071
commit
ff0ee93fe4
2 changed files with 2 additions and 2 deletions
|
|
@ -42,7 +42,7 @@ function highlightMatches(text: string, matchedText: string[]): string {
|
|||
return text;
|
||||
}
|
||||
const words = text.split(
|
||||
/(?=[.,'"/#!$%^&*;:{}=\-_`~()\s])|(?<=[.,'"/#!$%^&*;:{}=\-_`~()\s])/g
|
||||
/(?=[.,"/#!$%^&*;:{}=\-_`~()\s])|(?<=[.,"/#!$%^&*;:{}=\-_`~()\s])/g
|
||||
);
|
||||
|
||||
const normalizedWords = words.map((word) => {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function inverseDocumentFrequency(
|
|||
}
|
||||
|
||||
function tokenize(text: string): string[] {
|
||||
return text.match(/[a-zA-Z0-9]+/g) || [];
|
||||
return text.match(/[^\\\][.,"/#!?$%^&*;:{}=\-_`~()\s]+/g) || [];
|
||||
}
|
||||
|
||||
export const buildSearchService = <T>(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue