Klasse MascDocumentStream

java.lang.Object
opennlp.tools.formats.masc.MascDocumentStream
Alle implementierten Schnittstellen:
AutoCloseable, ObjectStream<MascDocument>

public class MascDocumentStream extends Object implements ObjectStream<MascDocument>
  • Konstruktordetails

    • MascDocumentStream

      public MascDocumentStream(File mascCorpusDirectory) throws IOException
      Löst aus:
      IOException
    • MascDocumentStream

      public MascDocumentStream(File mascCorpusDirectory, boolean searchRecursive, FileFilter fileFilter) throws IOException
      Creates a MascDocumentStream to read the documents from a given directory. Works iff all annotation files mentioned in the headers are present.
      Parameter:
      mascCorpusDirectory - the directory containing all the MASC files
      searchRecursive - whether the search should go through subdirectories
      fileFilter - a custom file filter to filter out some files or null to accept anything
      Löst aus:
      IOException - if any stage of the stream creation fails
  • Methodendetails

    • reset

      public void reset()
      Reset the reading of all documents to the first sentence. Reset the corpus to the first document.
      Angegeben von:
      reset in Schnittstelle ObjectStream<MascDocument>
    • read

      public MascDocument read() throws IOException
      Return the next document. Client needs to check if this document has the necessary annotations.
      Angegeben von:
      read in Schnittstelle ObjectStream<MascDocument>
      Gibt zurück:
      A corpus document with all its annotations.
      Löst aus:
      IOException - if anything goes wrong.
    • close

      public void close()
      Remove the corpus from the memory.
      Angegeben von:
      close in Schnittstelle AutoCloseable
      Angegeben von:
      close in Schnittstelle ObjectStream<MascDocument>