-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-chapter-detection.js
More file actions
33 lines (26 loc) · 1.07 KB
/
Copy pathtest-chapter-detection.js
File metadata and controls
33 lines (26 loc) · 1.07 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
// Simple test for chapter detection
const { detectChaptersFromFile } = require('./web/lib/chapterDetector');
async function testChapterDetection() {
try {
console.log('Testing chapter detection on DOCX file...');
const chapters = await detectChaptersFromFile('./web/data/samples/Blood and Memory - Bonus Scenes - Alyssa Evans.docx');
console.log('Detected chapters:', chapters.length);
console.log('');
chapters.forEach((chapter, index) => {
console.log(`Chapter ${index + 1}: "${chapter.title}"`);
console.log(`Content length: ${chapter.content.length}`);
console.log(`HTML length: ${chapter.html.length}`);
console.log(`Content preview: ${chapter.content.substring(0, 150)}...`);
console.log('---');
});
if (chapters.length > 0) {
console.log('✅ Chapter detection is working!');
} else {
console.log('❌ No chapters detected');
}
} catch (error) {
console.error('❌ Chapter detection failed:', error.message);
console.error(error.stack);
}
}
testChapterDetection();