debug_rubric.js
605 Bytes
const fs = require('fs');
const skillMd = fs.readFileSync('SKILL_v1.md', 'utf-8');
function norm(text) {
return (text || '').toLowerCase().replace(/[\s,;.::\/\-_=+()\[\]{|}"']/g, '');
}
function has(skillMd, kws) {
const s = norm(skillMd);
return kws.some(k => s.includes(norm(k)));
}
const testKws = [
['flag_desc', '分类标签'],
['icon', 'media_urls'],
['small_icon_desc', 'icon_desc_color'],
['emoticon'],
['topic_flag', '话题'],
['label_name', '新'],
['label_name', '热'],
];
for (const kws of testKws) {
console.log(kws.join(' | ') + ' -> ' + has(skillMd, kws));
}