    001    package org.maltparser.core.syntaxgraph.reader;
    002
    003    import java.io.InputStream;
    004    import java.io.InputStreamReader;
    005    import java.net.URL;
    006
    007    import org.maltparser.core.exception.MaltChainedException;
    008    import org.maltparser.core.io.dataformat.DataFormatInstance;
    009    import org.maltparser.core.syntaxgraph.TokenStructure;
    010
    011    /**
    012    *
    013    *
    014    * @author Johan Hall
    015    */
    016    public interface SyntaxGraphReader {
    017            /**
    018             * Opens a file for read only
    019             *
    020             * @param fileName      the file name of the file
    021             * @param charsetName   the name of the character encoding set
    022             * @throws MaltChainedException
    023             */
    024            public void open(String fileName, String charsetName) throws MaltChainedException;
    025            /**
    026             * Opens an URL for read only
    027             *
    028             * @param url the URL of the resource
    029             * @param charsetName the name of the character encoding set
    030             * @throws MaltChainedException
    031             */
    032            public void open(URL url, String charsetName) throws MaltChainedException;
    033            /**
    034             * Opens an input stream
    035             *
    036             * @param is an input stream
    037             * @param charsetName the name of the character encoding set
    038             * @throws MaltChainedException
    039             */
    040            public void open(InputStream is, String charsetName) throws MaltChainedException;
    041            /**
    042             * Cause the syntax graph reader to read the beginning of the file (such as header information)
    043             *
    044             * @throws MaltChainedException
    045             */
    046            public void readProlog() throws MaltChainedException;
    047
    048            /**
    049             * Reads a sentence (token structure, dependency structure or/and phrase structure)
    050             *
    051             * @param syntaxGraph a syntax graph (token structure, dependency structure or/and phrase structure)
    052             * @return true if there is more sentences to be processed, otherwise false.
    053             * @throws MaltChainedException
    054             */
    055            public boolean readSentence(TokenStructure syntaxGraph) throws MaltChainedException;
    056            /**
    057             * Reads the end of the file, after all sentences have been processed,
    058             *
    059             * @throws MaltChainedException
    060             */
    061            public void readEpilog() throws MaltChainedException;
    062            /**
    063             * Returns the current number of the sentence.
    064             *
    065             * @return the current number of the sentence.
    066             * @throws MaltChainedException
    067             */
    068            public int getSentenceCount() throws MaltChainedException;
    069            /**
    070             * Returns the input data format instance
    071             *
    072             * @return the input data format instance
    073             */
    074            public DataFormatInstance getDataFormatInstance();
    075            /**
    076             * Sets the input data format instance
    077             *
    078             * @param dataFormatInstance an input data format instance
    079             */
    080            public void setDataFormatInstance(DataFormatInstance dataFormatInstance);
    081            /**
    082             * Returns a string representation of the reader specific options.
    083             *
    084             * @return a string representation of the reader specific options.
    085             */
    086            public String getOptions();
    087            /**
    088             * Sets the reader specific options.
    089             *
    090             * @param optionString a string representation of the reader specific options
    091             * @throws MaltChainedException
    092             */
    093            public void setOptions(String optionString) throws MaltChainedException;
    094            /**
    095             * Closes the file or the input stream.
    096             *
    097             * @throws MaltChainedException
    098             */
    099            public void close() throws MaltChainedException;
    100
    101            public int getNIterations();
    102            public void setNIterations(int iterations);
    103            public int getIterationCounter();
    104    }