Practica1/src/es/uam/eps/bmi/search/TestSearcher.java
public static void main (String args[]) {
        
            if (args.length != 3) {
                System.out.println("Recibe 3 argumentos: Indice, lista de queries y lista de docs relevantes");
                return;
            }

            // Cargar index
            System.out.println("Cargando índice en RAM...");
            li = new LuceneIndexing();
            li.load(args[0]);
            
            // Buscar en él
            LuceneSearcher ls = new LuceneSearcher();
            ls.build(li);
            
            // Almacenar consultas
            ArrayList<String> queries = parseQueries(args[1]);
            
            // Almacenar documentos relevantes para cada consulta
            ArrayList<ArrayList<String>> relevantFilenames = parseRelevantFilenames(args[2]);
            
            // Calcular precisiones para cada consulta
            ArrayList<Double> p5s = new ArrayList<>();
            ArrayList<Double> p10s = new ArrayList<>();
            for (int i = 0; i < queries.size(); i++) {
                List<ScoredTextDocument> results = ls.search(queries.get(i));
                p5s.add(calculatePrecision(results, relevantFilenames.get(i), 5));
                p10s.add(calculatePrecision(results, relevantFilenames.get(i), 10));
            }
            System.out.println("Id \t p@5\t p@10");
            DecimalFormat df = new DecimalFormat("#.##");
            for (int i = 0; i < queries.size(); i++) {
                System.out.println((i+1) + " \t" + df.format(p5s.get(i)) + "\t" + df.format(p10s.get(i)));
            }
        
    }
/**
     * Recibe 3 argumentos: , lista de queries y lista de docs relevantes
     * @param args 
     */
Recibe 3 argumentos: , lista de queries y lista de docs relevantes
@param args
Recibe 3 argumentos : lista de queries y lista de docs relevantes @param args
public static void main (String args[]) {
            if (args.length != 3) {
                System.out.println("Recibe 3 argumentos: Indice, lista de queries y lista de docs relevantes");
                return;
            }
            System.out.println("Cargando índice en RAM...");
            li = new LuceneIndexing();
            li.load(args[0]);
            LuceneSearcher ls = new LuceneSearcher();
            ls.build(li);
            ArrayList<String> queries = parseQueries(args[1]);
            ArrayList<ArrayList<String>> relevantFilenames = parseRelevantFilenames(args[2]);
            ArrayList<Double> p5s = new ArrayList<>();
            ArrayList<Double> p10s = new ArrayList<>();
            for (int i = 0; i < queries.size(); i++) {
                List<ScoredTextDocument> results = ls.search(queries.get(i));
                p5s.add(calculatePrecision(results, relevantFilenames.get(i), 5));
                p10s.add(calculatePrecision(results, relevantFilenames.get(i), 10));
            }
            System.out.println("Id \t p@5\t p@10");
            DecimalFormat df = new DecimalFormat("#.##");
            for (int i = 0; i < queries.size(); i++) {
                System.out.println((i+1) + " \t" + df.format(p5s.get(i)) + "\t" + df.format(p10s.get(i)));
            }
    }
public static void main ( String args [ ] ) { if ( args . length != 3 ) { System . out . println ( "Recibe 3 argumentos: Indice, lista de queries y lista de docs relevantes" ) ; return ; } System . out . println ( "Cargando índice en RAM...") ; li = new LuceneIndexing ( ) ; li . load ( args [ 0 ] ) ; LuceneSearcher ls = new LuceneSearcher ( ) ; ls . build ( li ) ; ArrayList < String > queries = parseQueries ( args [ 1 ] ) ; ArrayList < ArrayList < String > > relevantFilenames = parseRelevantFilenames ( args [ 2 ] ) ; ArrayList < Double > p5s = new ArrayList < > ( ) ; ArrayList < Double > p10s = new ArrayList < > ( ) ; for ( int i = 0 ; i < queries . size ( ) ; i ++ ) { List < ScoredTextDocument > results = ls . search ( queries . get ( i ) ) ; p5s . add ( calculatePrecision ( results , relevantFilenames . get ( i ) , 5 ) ) ; p10s . add ( calculatePrecision ( results , relevantFilenames . get ( i ) , 10 ) ) ; } System . out . println ( "Id \t p@5\t p@10" ) ; DecimalFormat df = new DecimalFormat ( "#.##" ) ; for ( int i = 0 ; i < queries . size ( ) ; i ++ ) { System . out . println ( ( i + 1 ) + " \t" + df . format ( p5s . get ( i ) ) + "\t" + df . format ( p10s . get ( i ) ) ) ; } }
Recibe 3 argumentos: , lista de queries y lista de docs relevantes
 @param args
Recibe 3 argumentos : lista de queries y lista de docs relevantes @param args
// Cargar index
 // Buscar en él
 // Almacenar consultas
 // Almacenar documentos relevantes para cada consulta
 // Calcular precisiones para cada consulta
