title: How to read document for Named Entity Recognition in OpenNLP
body: <p>I am new to java and the requirement for me is to read a document and perform named entity documentation. For simple strings I did the following</p>
  
  <pre><code>InputStream is = new FileInputStream("data/en-ner-person.bin");
  TokenNameFinderModel model = new TokenNameFinderModel(is);
  is.close();
  NameFinderME nameFinder = new NameFinderME(model);
  String []sentence = new String[]{"Smith",
                  "Smithosian",
                  "is",
                  "a",
                  "person"
                  };
  
  
  
     Span nameSpans[] = nameFinder.find(sentence);
  </code></pre>
  
  <p>However, I need to actually read the stream from a document and then generate an XML.
  Can anyone please tell me how to do that</p>
  
  <p>Thanks</p>