001package org.maltparser.core.syntaxgraph.writer;
002
003import java.io.OutputStream;
004
005import org.maltparser.core.exception.MaltChainedException;
006import org.maltparser.core.io.dataformat.DataFormatInstance;
007import org.maltparser.core.syntaxgraph.TokenStructure;
008/**
009*
010*
011* @author Johan Hall
012*/
013public interface SyntaxGraphWriter {
014        /**
015         * Opens a file for writing
016         * 
017         * @param fileName      the file name of the file
018         * @param charsetName   the name of the character encoding set 
019         * @throws MaltChainedException
020         */
021        public void open(String fileName, String charsetName) throws MaltChainedException;
022        /**
023         * Opens an output stream
024         * 
025         * @param os an output stream
026         * @param charsetName the name of the character encoding set 
027         * @throws MaltChainedException
028         */
029        public void open(OutputStream os, String charsetName) throws MaltChainedException;
030        /**
031         * Cause the syntax graph writer to write the beginning of the file (such as header information)
032         * 
033         * @throws MaltChainedException
034         */
035        public void writeProlog() throws MaltChainedException;
036        /**
037         * Writes a sentence (token structure, dependency structure or/and phrase structure)
038         * 
039         * @param syntaxGraph a syntax graph (token structure, dependency structure or/and phrase structure)
040         * @throws MaltChainedException
041         */
042        public void writeSentence(TokenStructure syntaxGraph) throws MaltChainedException;
043        /**
044         * Writes the end of the file 
045         * 
046         * @throws MaltChainedException
047         */
048        public void writeEpilog() throws MaltChainedException;
049        /**
050         * Returns the output data format instance
051         * 
052         * @return the output data format instance
053         */
054        public DataFormatInstance getDataFormatInstance();
055        /**
056         * Sets the output data format instance
057         * 
058         * @param dataFormatInstance an output data format instance
059         */
060        public void setDataFormatInstance(DataFormatInstance dataFormatInstance);
061        /**
062         * Returns a string representation of the writer specific options.
063         * 
064         * @return a string representation of the writer specific options.
065         */
066        public String getOptions();
067        /**
068         * Sets the writer specific options.
069         * 
070         * @param optionString a string representation of the writer specific options
071         * @throws MaltChainedException
072         */
073        public void setOptions(String optionString) throws MaltChainedException;
074        /**
075         * Closes the file or the output stream.
076         * 
077         * @throws MaltChainedException
078         */
079        public void close() throws MaltChainedException;
080}