Spaces:
Paused
Paused
Download src/lib/server/websearch/markdown/utils/nlp.ts from maksym-work/chat_ui: direct link, hf CLI and curl.
- Browser
- Download file 333 Bytes
-
https://huggingface.co/spaces/maksym-work/chat_ui/resolve/main/src/lib/server/websearch/markdown/utils/nlp.ts
- Command line
-
hf download hf://spaces/maksym-work/chat_ui/src/lib/server/websearch/markdown/utils/nlp.ts
-
curl -L -o nlp.ts https://huggingface.co/spaces/maksym-work/chat_ui/resolve/main/src/lib/server/websearch/markdown/utils/nlp.ts
333 Bytes
| /** Remove excess whitespace and newlines */ | |
| export const sanitizeString = (str: string) => | |
| str | |
| .split("\n") | |
| .map((s) => s.trim()) | |
| .filter(Boolean) | |
| .join("\n") | |
| .replaceAll(/ +/g, " "); | |
| /** Collapses a string into a single line */ | |
| export const collapseString = (str: string) => sanitizeString(str.replaceAll(/\n/g, " ")); | |