Xtract.java (1594B)
1 /* 2 This file is part of libextractor. 3 Copyright (C) 2002, 2003, 2004, 2007, 2010, 2012 Vidyut Samanta and Christian Grothoff 4 5 libextractor is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published 7 by the Free Software Foundation; either version 3, or (at your 8 option) any later version. 9 10 libextractor is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with libextractor; see the file COPYING. If not, write to the 17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 Boston, MA 02110-1301, USA. 19 */ 20 package org.gnu.libextractor; 21 22 import java.util.ArrayList; 23 24 /** 25 * Java version of extract. This is just a tiny demo-application 26 * to show how to use the Java API. The C version of extract is 27 * much better and should probably be used in practice. 28 * 29 * @author Christian Grothoff 30 */ 31 public final class Xtract { 32 33 public static void main(String[] args) { 34 Extractor ex = Extractor.getDefault(); 35 for (int i=0;i<args.length;i++) { 36 ArrayList keywords = ex.extract(args[i]); 37 System.out.println("Keywords for " + args[i] + ":"); 38 for (int j=0;j<keywords.size();j++) 39 System.out.println(keywords.get(j)); 40 } 41 // no need to unload, finalizer does the rest... 42 } 43 44 } // end of Xtract