    001    package org.maltparser.parser.algorithm.twoplanar;
    002
    003    import org.maltparser.core.exception.MaltChainedException;
    004    import org.maltparser.core.feature.function.Function;
    005    import org.maltparser.parser.AbstractParserFactory;
    006    import org.maltparser.parser.Algorithm;
    007    import org.maltparser.parser.DependencyParserConfig;
    008    import org.maltparser.parser.ParserConfiguration;
    009    /**
    010     * @author Carlos Gomez Rodriguez
    011     *
    012     */
    013    public abstract class TwoPlanarFactory implements AbstractParserFactory {
    014            protected Algorithm algorithm;
    015            protected DependencyParserConfig manager;
    016
    017            public TwoPlanarFactory(Algorithm algorithm) {
    018                    setAlgorithm(algorithm);
    019                    setManager(algorithm.getManager());
    020            }
    021
    022            public ParserConfiguration makeParserConfiguration() throws MaltChainedException {
    023                    if (manager.getConfigLogger().isInfoEnabled()) {
    024                            manager.getConfigLogger().info("  Parser configuration : Two-Planar with no_covered_roots = " + manager.getOptionValue("planar", "no_covered_roots").toString().toUpperCase() + ", " + "acyclicity = " + manager.getOptionValue("planar", "acyclicity").toString().toUpperCase() + ", planar root handling = " + manager.getOptionValue("2planar" , "planar_root_handling").toString().toUpperCase() + ", reduce on switch = " + manager.getOptionValue("2planar" , "reduceonswitch").toString().toUpperCase() + "\n");
    025                    }
    026                    return new TwoPlanarConfig(manager.getSymbolTables() , manager.getOptionValue("planar", "no_covered_roots").toString() , manager.getOptionValue("planar", "acyclicity").toString() , manager.getOptionValue("2planar" , "reduceonswitch").toString()  , manager.getOptionValue("2planar" , "planar_root_handling").toString() );
    027            }
    028
    029            public Function makeFunction(String subFunctionName) throws MaltChainedException {
    030                    return new TwoPlanarAddressFunction(subFunctionName, algorithm);
    031            }
    032
    033            public Algorithm getAlgorithm() {
    034                    return algorithm;
    035            }
    036
    037            public void setAlgorithm(Algorithm algorithm) {
    038                    this.algorithm = algorithm;
    039            }
    040
    041            public DependencyParserConfig getManager() {
    042                    return manager;
    043            }
    044
    045            public void setManager(DependencyParserConfig manager) {
    046                    this.manager = manager;
    047            }
    048    }