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

Method calculateRelationScore

MCP/scripts/fetch-issues.js:654–675  ·  view source on GitHub ↗
(article1, article2)

Source from the content-addressed store, hash-verified

652 }
653
654 calculateRelationScore(article1, article2) {
655 let score = 0;
656
657 // 比较 CSS 属性相似度
658 const props1 = new Set(JSON.parse(article1.css_properties));
659 const props2 = new Set(JSON.parse(article2.css_properties));
660 const commonProps = new Set([...props1].filter(x => props2.has(x)));
661 score += commonProps.size * 2;
662
663 // 比较技术相似度
664 const techs1 = new Set(JSON.parse(article1.techniques));
665 const techs2 = new Set(JSON.parse(article2.techniques));
666 const commonTechs = new Set([...techs1].filter(x => techs2.has(x)));
667 score += commonTechs.size * 3;
668
669 // 考虑难度级别
670 if (article1.complexity_level === article2.complexity_level) {
671 score += 1;
672 }
673
674 return score;
675 }
676
677 generateEnhancedStats() {
678 console.log('\n📊 Enhanced Database Statistics:');

Callers 1

updateRelatedArticlesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected