中英文切换
This commit is contained in:
12
tmp_tokens.cjs
Normal file
12
tmp_tokens.cjs
Normal file
@@ -0,0 +1,12 @@
|
||||
const a = require('./tmp_missing.json');
|
||||
const z = a.zhAdd;
|
||||
const tokens = new Set();
|
||||
for (const ns of Object.keys(z)) {
|
||||
for (const leaf of Object.keys(z[ns])) {
|
||||
const words = leaf.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2').split(/[\s._]+/).filter(Boolean);
|
||||
for (const w of words) tokens.add(w.toLowerCase());
|
||||
}
|
||||
}
|
||||
const arr = [...tokens].sort();
|
||||
console.log('Token count:', arr.length);
|
||||
console.log(arr.join(' '));
|
||||
Reference in New Issue
Block a user