Spaces:
Paused
Paused
| #!/usr/bin/env python3 | |
| """Check Clone Profile i Neo4j""" | |
| from neo4j import GraphDatabase | |
| driver = GraphDatabase.driver( | |
| 'neo4j+s://054eff27.databases.neo4j.io', | |
| auth=('neo4j', 'Qrt37mkb0xBZ7_ts5tG1J70K2mVDGPMF2L7Njlm7cg8') | |
| ) | |
| with driver.session() as s: | |
| # Clone Profile | |
| result = s.run(''' | |
| MATCH (p:CloneProfile) | |
| RETURN p.name as name, p.role as role, p.totalMessages as msgs, | |
| p.formalityScore as formality, p.technicalDensity as tech, | |
| p.personalityTraits as traits, p.expertiseAreas as expertise | |
| ''') | |
| print("=" * 60) | |
| print("🧬 CLONE PROFILE I NEO4J") | |
| print("=" * 60) | |
| for r in result: | |
| print(f"Navn: {r['name']}") | |
| print(f"Rolle: {r['role']}") | |
| print(f"Beskeder analyseret: {r['msgs']}") | |
| print(f"Formalitet: {round(r['formality'] * 100)}%") | |
| print(f"Teknisk densitet: {round(r['tech'] * 100)}%") | |
| print() | |
| print("Personlighedstræk:") | |
| for trait in r['traits']: | |
| print(f" • {trait}") | |
| print() | |
| print("Ekspertiseområder:") | |
| for exp in r['expertise']: | |
| print(f" 🎯 {exp}") | |
| # Knowledge domains with relationships | |
| print() | |
| print("=" * 60) | |
| print("🧠 KNOWLEDGE DOMAINS") | |
| print("=" * 60) | |
| result = s.run(''' | |
| MATCH (p:CloneProfile)-[r:HAS_EXPERTISE]->(d:KnowledgeDomain) | |
| RETURN d.name as domain, r.confidence as conf, r.messageCount as count | |
| ORDER BY r.confidence DESC LIMIT 8 | |
| ''') | |
| for r in result: | |
| bar = "█" * int(r['conf'] * 10) | |
| print(f" {r['domain']:25} {bar} {round(r['conf'] * 100)}%") | |
| # Common phrases | |
| print() | |
| print("=" * 60) | |
| print("💬 COMMON PHRASES (cleaned)") | |
| print("=" * 60) | |
| result = s.run(''' | |
| MATCH (p:CloneProfile)-[r:USES_PHRASE]->(ph:CommonPhrase) | |
| WHERE NOT ph.phrase CONTAINS 'http' | |
| AND NOT ph.phrase CONTAINS 'mailto' | |
| AND NOT ph.phrase CONTAINS 'urldefense' | |
| RETURN ph.phrase as phrase, r.frequency as freq | |
| ORDER BY r.frequency DESC LIMIT 10 | |
| ''') | |
| for r in result: | |
| print(f" \"{r['phrase']}\" ({r['freq']}x)") | |
| # Topics (cleaned) | |
| print() | |
| print("=" * 60) | |
| print("🏷️ TOP TOPICS (cleaned)") | |
| print("=" * 60) | |
| result = s.run(''' | |
| MATCH (p:CloneProfile)-[r:DISCUSSES]->(t:CloneTopic) | |
| WHERE NOT t.name CONTAINS 'http' | |
| AND NOT t.name CONTAINS 'mailto' | |
| AND NOT t.name CONTAINS 'urldefense' | |
| AND NOT t.name CONTAINS 'gnpmbas' | |
| AND NOT t.name CONTAINS 'safelink' | |
| AND size(t.name) > 3 | |
| RETURN t.name as topic, r.frequency as freq | |
| ORDER BY r.frequency DESC LIMIT 20 | |
| ''') | |
| for r in result: | |
| print(f" {r['topic']}: {r['freq']}") | |
| # Total stats | |
| print() | |
| print("=" * 60) | |
| print("📊 TOTAL GRAPH STATS") | |
| print("=" * 60) | |
| result = s.run(''' | |
| MATCH (p:CloneProfile) | |
| OPTIONAL MATCH (p)-[:HAS_EXPERTISE]->(d:KnowledgeDomain) | |
| OPTIONAL MATCH (p)-[:USES_PHRASE]->(ph:CommonPhrase) | |
| OPTIONAL MATCH (p)-[:DISCUSSES]->(t:CloneTopic) | |
| RETURN count(DISTINCT d) as domains, count(DISTINCT ph) as phrases, count(DISTINCT t) as topics | |
| ''') | |
| for r in result: | |
| print(f" Knowledge Domains: {r['domains']}") | |
| print(f" Common Phrases: {r['phrases']}") | |
| print(f" Topics: {r['topics']}") | |
| driver.close() | |
| print() | |
| print("✅ Clone Profile verificeret!") | |