feat: 第 13-16 章正文(Skill 机制 / HTTP 接口层 / 前端 / 基础设施与部署)
This commit is contained in:
16
project/ai-agent-scafford-go/tools/_tmp_count.js
Normal file
16
project/ai-agent-scafford-go/tools/_tmp_count.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const fs = require('fs');
|
||||
const h = fs.readFileSync('15-frontend.html', 'utf8');
|
||||
let art = (h.match(/<article>([\s\S]*)<\/article>/) || [, ''])[1];
|
||||
art = art.replace(/<pre[\s\S]*?<\/pre>/g, ' ')
|
||||
.replace(/<nav class="pager">[\s\S]*?<\/nav>/g, ' ')
|
||||
.replace(/<p class="foot">[\s\S]*?<\/p>/g, ' ')
|
||||
.replace(/<p class="chapnav">[\s\S]*?<\/p>/g, ' ');
|
||||
art = art.replace(/<[^>]+>/g, '').replace(/\s+/g, '');
|
||||
let cjk = 0, ascii = 0, punct = 0, other = 0;
|
||||
for (const ch of art) {
|
||||
const c = ch.codePointAt(0);
|
||||
if (c >= 0x4e00 && c <= 0x9fff) cjk++;
|
||||
else if (c >= 0x20 && c <= 0x7e) ascii++;
|
||||
else punct++;
|
||||
}
|
||||
console.log({ total: art.length, cjk, ascii, punct });
|
||||
Reference in New Issue
Block a user