-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestMatching.js
More file actions
45 lines (38 loc) · 1.24 KB
/
Copy pathtestMatching.js
File metadata and controls
45 lines (38 loc) · 1.24 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
// testMatching.js - Simple test script to verify the matching algorithm
const { computeTextSimilarity } = require('./aiService');
async function testMatching() {
console.log('Testing text similarity computation...');
// Test cases
const testCases = [
{
text1: "iPhone 12 Pro Max lost in Mumbai Central",
text2: "iPhone 12 Pro Max found at Mumbai Central"
},
{
text1: "Black leather wallet lost in Delhi Airport",
text2: "Black leather wallet found at Delhi Airport"
},
{
text1: "Samsung Galaxy Tab lost in Bangalore",
text2: "iPad Pro found in Bangalore"
}
];
for (let i = 0; i < testCases.length; i++) {
const { text1, text2 } = testCases[i];
try {
console.log(`\nTest Case ${i + 1}:`);
console.log(`Text 1: ${text1}`);
console.log(`Text 2: ${text2}`);
const similarity = await computeTextSimilarity(text1, text2);
console.log(`Similarity Score: ${similarity.toFixed(4)}`);
if (similarity >= 0.8) {
console.log('✅ Match found!');
} else {
console.log('❌ No match (below threshold)');
}
} catch (error) {
console.error(`Error in test case ${i + 1}:`, error.message);
}
}
}
testMatching();