Spaces:
Paused
Paused
Download test/normalize_html.ts from asemxin1976/wechat-article: direct link, hf CLI and curl.
- Browser
- Download file 707 Bytes
-
https://huggingface.co/spaces/asemxin1976/wechat-article/resolve/main/test/normalize_html.ts
- Command line
-
hf download hf://spaces/asemxin1976/wechat-article/test/normalize_html.ts
-
curl -L -o normalize_html.ts https://huggingface.co/spaces/asemxin1976/wechat-article/resolve/main/test/normalize_html.ts
707 Bytes
| import { normalizeHtml } from '#shared/utils/html'; | |
| import { read, samples, write } from './common'; | |
| function normalizeOutPath(input: string): string { | |
| const segments = input.split('/'); | |
| segments[segments.length - 1] = 'output/normalize-' + segments[segments.length - 1]; | |
| return segments.join('/'); | |
| } | |
| function run() { | |
| for (const group of samples.filter(group => group.hasContent)) { | |
| console.group(group.name); | |
| for (const samplePath of group.samples) { | |
| const html = read(samplePath); | |
| const result = normalizeHtml(html); | |
| write(normalizeOutPath(samplePath), result); | |
| console.log(samplePath, '已处理'); | |
| } | |
| console.groupEnd(); | |
| console.log(); | |
| } | |
| } | |
| run(); | |