import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import com.knowledgebooks.NLP; import com.knowledgebooks.NlpResults; /** * *

Copyright 2002-2008 by Mark Watson. All rights reserved.

* This software is not public domain. It can be legally used under either of the * following licenses:

* 1. KnowledgeBooks.com Non Commercial Royality Free License
* 2. KnowledgeBooks.com Commercial Use License

* see www.knowledgebooks.com for details */ public class ExampleNLP { private static String contents; public static void main(String[] args) throws FileNotFoundException { if (args.length > 0) { File in = new File(args[0]); contents = new Scanner(in).useDelimiter("\\Z").next(); } else contents = "President George W. Bush will meet Iraqi President Jalal Talabani on Wednesday to discuss a long-term security pact for U.S. forces to stay in Iraq, among other issues, the White House said on Tuesday. The two countries have been negotiating a new security deal to provide a legal basis for U.S. troops to stay in Iraq after a United Nations mandate expires on December 31, and a separate long-term agreement on political, economic and security ties. The talks were deadlocked amid concerns about Iraqi sovereignty. Bush and Iraqi Prime Minister Nuri al-Maliki spoke last week via video conference call and the White House said that the two had agreed that the discussions for a pact were \"proceeding well.\" That call came after Maliki earlier this month had warned that the talks were deadlocked amid concerns about Iraqi sovereignty."; NLP nlp = new NLP(contents); System.out.println("\nTest Contents:\n\n" + contents + "\n\n"); NlpResults results = nlp.getResults(); System.out.println(" keyWords:" + results.getKeyWords()); System.out.println(" keywordScores:" + results.getKeyWordScores()); System.out.println(" tokens:"+ results.getTextTokens()); System.out.println(" tags:"+ results.getTextTags()); System.out.println(" stems:"+ results.getTextStems()); System.out.println(" sentanceStartIndices:"+ results.getStartSentanceBoundaries()); System.out.println(" sentanceStoptIndices:"+ results.getEndSentanceBoundaries()); System.out.println(" human names:" + results.getHumanNames()); System.out.println(" place names:" + results.getPlaceNames()); System.out.println(" summary:"+ results.getSummary()); System.out.println("\n"); } }