-
Notifications
You must be signed in to change notification settings - Fork 773
Expand file tree
/
Copy pathtest-complexity-quick.ts
More file actions
48 lines (38 loc) · 1.9 KB
/
Copy pathtest-complexity-quick.ts
File metadata and controls
48 lines (38 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Quick test of complexity detection improvements
*/
import { ComplexityDetector } from '@cascadeflow/core';
const detector = new ComplexityDetector();
const testQueries = [
{ q: "What color is the sky?", expected: "trivial" },
{ q: "What's the capital of France?", expected: "trivial" },
{ q: "Translate 'hello' to Spanish", expected: "simple" },
{ q: "Explain the difference between lists and tuples in Python", expected: "moderate" },
{ q: "Write a function to reverse a string in Python", expected: "moderate" },
{ q: "Explain quantum entanglement and its implications for quantum computing in detail", expected: "expert" },
{ q: "Design a microservices architecture for a large-scale e-commerce platform with high availability", expected: "expert" },
{ q: "Analyze the philosophical implications of consciousness and free will in the context of determinism", expected: "expert" },
];
console.log('='.repeat(80));
console.log('COMPLEXITY DETECTION TEST');
console.log('='.repeat(80));
console.log();
let correct = 0;
let total = testQueries.length;
for (const test of testQueries) {
const result = detector.detect(test.q, true);
const match = result.complexity === test.expected ? '✅' : '❌';
if (result.complexity === test.expected) correct++;
console.log(`${match} Query: ${test.q}`);
console.log(` Expected: ${test.expected}, Got: ${result.complexity} (conf: ${result.confidence.toFixed(2)})`);
if (result.metadata?.technicalTerms && result.metadata.technicalTerms.length > 0) {
console.log(` Technical Terms: ${result.metadata.technicalTerms.join(', ')}`);
}
if (result.metadata?.domains && result.metadata.domains.size > 0) {
console.log(` Domains: ${Array.from(result.metadata.domains).join(', ')}`);
}
console.log();
}
console.log('='.repeat(80));
console.log(`ACCURACY: ${correct}/${total} (${((correct/total)*100).toFixed(1)}%)`);
console.log('='.repeat(80));