Package org.apache.nutch.searcher

Examples of org.apache.nutch.searcher.Summarizer


      System.out.println("Usage: java org.apache.nutch.searcher.Summarizer <textfile> <queryStr>");
      return;
    }
   
    Configuration conf = NutchConfiguration.create();
    Summarizer s = new BasicSummarizer(conf);
   
    //
    // Parse the args
    //
    File textFile = new File(argv[0]);
    StringBuffer queryBuf = new StringBuffer();
    for (int i = 1; i < argv.length; i++) {
      queryBuf.append(argv[i]);
      queryBuf.append(" ");
    }
   
    //
    // Load the text file into a single string.
    //
    StringBuffer body = new StringBuffer();
    BufferedReader in = new BufferedReader(new FileReader(textFile));
    try {
      System.out.println("About to read " + textFile + " from " + in);
      String str = in.readLine();
      while (str != null) {
        body.append(str);
        str = in.readLine();
      }
    } finally {
      in.close();
    }
   
    // Convert the query string into a proper Query
    Query query = Query.parse(queryBuf.toString(), conf);
    System.out.println("Summary: '" + s.getSummary(body.toString(), query) + "'");
  }
View Full Code Here


      System.out.println("Usage: java org.apache.nutch.searcher.Summarizer <textfile> <queryStr>");
      return;
    }
   
    Configuration conf = NutchConfiguration.create();
    Summarizer s = new BasicSummarizer(conf);
   
    //
    // Parse the args
    //
    File textFile = new File(argv[0]);
    StringBuffer queryBuf = new StringBuffer();
    for (int i = 1; i < argv.length; i++) {
      queryBuf.append(argv[i]);
      queryBuf.append(" ");
    }
   
    //
    // Load the text file into a single string.
    //
    StringBuffer body = new StringBuffer();
    BufferedReader in = new BufferedReader(new FileReader(textFile));
    try {
      System.out.println("About to read " + textFile + " from " + in);
      String str = in.readLine();
      while (str != null) {
        body.append(str);
        str = in.readLine();
      }
    } finally {
      in.close();
    }
   
    // Convert the query string into a proper Query
    Query query = Query.parse(queryBuf.toString(), conf);
    System.out.println("Summary: '" + s.getSummary(body.toString(), query) + "'");
  }
View Full Code Here

      System.out.println("Usage: java org.apache.nutch.searcher.Summarizer <textfile> <queryStr>");
      return;
    }
   
    Configuration conf = NutchConfiguration.create();
    Summarizer s = new BasicSummarizer(conf);
   
    //
    // Parse the args
    //
    File textFile = new File(argv[0]);
    StringBuffer queryBuf = new StringBuffer();
    for (int i = 1; i < argv.length; i++) {
      queryBuf.append(argv[i]);
      queryBuf.append(" ");
    }
   
    //
    // Load the text file into a single string.
    //
    StringBuffer body = new StringBuffer();
    BufferedReader in = new BufferedReader(new FileReader(textFile));
    try {
      System.out.println("About to read " + textFile + " from " + in);
      String str = in.readLine();
      while (str != null) {
        body.append(str);
        str = in.readLine();
      }
    } finally {
      in.close();
    }
   
    // Convert the query string into a proper Query
    Query query = Query.parse(queryBuf.toString(), conf);
    System.out.println("Summary: '" + s.getSummary(body.toString(), query) + "'");
  }
View Full Code Here

TOP

Related Classes of org.apache.nutch.searcher.Summarizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.