@@ -8,18 +8,28 @@ import * as path from 'path';
88async function main ( ) {
99 const args = process . argv . slice ( 2 ) ;
1010 if ( args . length < 2 ) {
11- console . log ( 'Usage: npx ts-node compare_scanning.ts <file1> <file2> [--spelling1 <id>] [--spelling2 <id>]' ) ;
11+ console . log ( 'Usage: npx ts-node compare_scanning.ts <file1> <file2> [--spelling1 <id>] [--spelling2 <id>] [--use-prediction] [--prediction-selections <n>]' ) ;
12+ console . log ( '' ) ;
13+ console . log ( 'Options:' ) ;
14+ console . log ( ' --use-prediction Use prediction instead of common word efforts for missing words' ) ;
15+ console . log ( ' --prediction-selections Average number of prediction selections (default: 1.5)' ) ;
16+ console . log ( '' ) ;
17+ console . log ( 'Note: By default, missing words use common word baseline efforts (matching Ruby aac-metrics)' ) ;
1218 process . exit ( 1 ) ;
1319 }
1420
1521 const file1 = args [ 0 ] ;
1622 const file2 = args [ 1 ] ;
1723 let spelling1 : string | undefined ;
1824 let spelling2 : string | undefined ;
25+ let usePrediction = false ;
26+ let predictionSelections = 1.5 ;
1927
2028 for ( let i = 0 ; i < args . length ; i ++ ) {
2129 if ( args [ i ] === '--spelling1' ) spelling1 = args [ i + 1 ] ;
2230 if ( args [ i ] === '--spelling2' ) spelling2 = args [ i + 1 ] ;
31+ if ( args [ i ] === '--use-prediction' ) usePrediction = true ;
32+ if ( args [ i ] === '--prediction-selections' ) predictionSelections = parseFloat ( args [ i + 1 ] ) ;
2333 }
2434
2535 const calculator = new Analytics . MetricsCalculator ( ) ;
@@ -28,7 +38,8 @@ async function main() {
2838 console . log ( `\n📚 AAC Pageset Scanning analysis` ) ;
2939 console . log ( `=========================` ) ;
3040 console . log ( `Target 1: ${ path . basename ( file1 ) } ` ) ;
31- console . log ( `Target 2: ${ path . basename ( file2 ) } \n` ) ;
41+ console . log ( `Target 2: ${ path . basename ( file2 ) } ` ) ;
42+ console . log ( `Missing word method: ${ usePrediction ? 'Prediction' : 'Common word efforts' } ${ usePrediction ? ` (selections: ${ predictionSelections } )` : '' } \n` ) ;
3243
3344 try {
3445 const p1 = getProcessor ( path . extname ( file1 ) === '.zip' ? '.ce' : path . extname ( file1 ) ) ;
@@ -69,7 +80,11 @@ async function main() {
6980 scanningConfig : scenario . config
7081 } ) ;
7182
72- const comparison = comparer . compare ( metrics1 , metrics2 , { includeSentences : true } ) ;
83+ const comparison = comparer . compare ( metrics1 , metrics2 , {
84+ includeSentences : true ,
85+ usePrediction,
86+ predictionSelections
87+ } ) ;
7388
7489 printScenarioDetails ( comparison , path . basename ( file1 ) , path . basename ( file2 ) ) ;
7590 }
0 commit comments