MCPcopy Create free account
hub / github.com/chokcoco/iCSS / generateLabelStatistics

Method generateLabelStatistics

MCP/scripts/fetch-issues.js:1276–1342  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1274 }
1275
1276 async generateLabelStatistics() {
1277 console.log('\n📊 Label Statistics:');
1278
1279 // 标签使用统计
1280 this.db.all(`
1281 SELECT
1282 l.label,
1283 l.category,
1284 COUNT(al.issue_number) as usage_count,
1285 AVG(al.weight) as avg_weight
1286 FROM label_categories l
1287 LEFT JOIN article_labels al ON l.label = al.label
1288 GROUP BY l.label, l.category
1289 ORDER BY usage_count DESC
1290 `, [], (err, rows) => {
1291 if (err) {
1292 console.error('Error generating label stats:', err);
1293 return;
1294 }
1295
1296 console.log('\n🏷️ Label Usage by Category:');
1297 const byCategory = {};
1298 rows.forEach(row => {
1299 if (!byCategory[row.category]) {
1300 byCategory[row.category] = [];
1301 }
1302 byCategory[row.category].push({
1303 label: row.label,
1304 count: row.usage_count,
1305 weight: row.avg_weight
1306 });
1307 });
1308
1309 Object.entries(byCategory).forEach(([category, labels]) => {
1310 console.log(`\n${category}:`);
1311 labels.forEach(({label, count, weight}) => {
1312 console.log(` ${label}: ${count} articles (avg weight: ${weight?.toFixed(2) || 0})`);
1313 });
1314 });
1315
1316 // 标签关系统计
1317 this.db.all(`
1318 SELECT
1319 label1,
1320 label2,
1321 cooccurrence_count,
1322 correlation_score
1323 FROM label_relations
1324 WHERE correlation_score > 0.3
1325 ORDER BY correlation_score DESC
1326 LIMIT 10
1327 `, [], (err, relations) => {
1328 if (err) {
1329 console.error('Error getting label relations:', err);
1330 return;
1331 }
1332
1333 console.log('\n🔗 Strong Label Correlations:');

Callers 1

saveIssuesToDatabaseMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected