예제 #1
0
        protected internal SymbolTable edgelabelSymbolTable;         // TODO more complex

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public HeadRules(org.apache.log4j.Logger logger, org.maltparser.core.io.dataformat.DataFormatInstance dataFormatInstance, org.maltparser.core.symbol.SymbolTableHandler symbolTableHandler) throws org.maltparser.core.exception.MaltChainedException
        public HeadRules(Logger logger, DataFormatInstance dataFormatInstance, SymbolTableHandler symbolTableHandler)
        {
            Logger = logger;
            this.dataFormatInstance = dataFormatInstance;
            this.symbolTableHandler = symbolTableHandler;
            nonTerminalSymbolTable  = symbolTableHandler.addSymbolTable("CAT");
            edgelabelSymbolTable    = symbolTableHandler.addSymbolTable("LABEL");
        }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void initialize(Object[] arguments) throws org.maltparser.core.exception.MaltChainedException
        public void initialize(object[] arguments)
        {
            if (arguments.Length != 3)
            {
                throw new FeatureException("Could not initialize Merge3Feature: number of arguments are not correct. ");
            }
            if (!(arguments[0] is FeatureFunction))
            {
                throw new FeatureException("Could not initialize Merge3Feature: the first argument is not a feature. ");
            }
            if (!(arguments[1] is FeatureFunction))
            {
                throw new FeatureException("Could not initialize Merge3Feature: the second argument is not a feature. ");
            }
            if (!(arguments[2] is FeatureFunction))
            {
                throw new FeatureException("Could not initialize Merge3Feature: the third argument is not a feature. ");
            }
            FirstFeature  = (FeatureFunction)arguments[0];
            SecondFeature = (FeatureFunction)arguments[1];
            ThirdFeature  = (FeatureFunction)arguments[2];
            if (firstFeature.Type != secondFeature.Type || firstFeature.Type != thirdFeature.Type)
            {
                throw new FeatureException("Could not initialize MergeFeature: the arguments are not of the same type.");
            }
            type = firstFeature.Type;
            string name = "MERGE3_" + firstFeature.MapIdentifier + "_" + secondFeature.MapIdentifier + "_" + thirdFeature.MapIdentifier;

            SymbolTable = tableHandler.addSymbolTable(name, ColumnDescription.INPUT, ColumnDescription.STRING, "One");
        }
예제 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void initialize(Object[] arguments) throws org.maltparser.core.exception.MaltChainedException
        public void initialize(object[] arguments)
        {
            if (arguments.Length != 3)
            {
                throw new FeatureException("Could not initialize InputArcFeature: number of arguments are not correct. ");
            }
            // Checks that the two arguments are address functions

            if (!(arguments[0] is string))
            {
                throw new FeatureException("Could not initialize InputArcFeature: the first argument is not a string. ");
            }
            if (!(arguments[1] is AddressFunction))
            {
                throw new SyntaxGraphException("Could not initialize InputArcFeature: the second argument is not an address function. ");
            }
            if (!(arguments[2] is AddressFunction))
            {
                throw new SyntaxGraphException("Could not initialize InputArcFeature: the third argument is not an address function. ");
            }
            AddressFunction1 = (AddressFunction)arguments[1];
            AddressFunction2 = (AddressFunction)arguments[2];

            Column      = dataFormatInstance.getColumnDescriptionByName((string)arguments[0]);
            SymbolTable = tableHandler.addSymbolTable("ARC_" + column.Name, ColumnDescription.INPUT, ColumnDescription.STRING, "one");
            table.addSymbol("LEFT");
            table.addSymbol("RIGHT");
        }
예제 #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void createColumnDescriptions(org.maltparser.core.symbol.SymbolTableHandler symbolTables, java.util.Map<String, DataFormatEntry> entries, String nullValueStrategy) throws org.maltparser.core.exception.MaltChainedException
        private void createColumnDescriptions(SymbolTableHandler symbolTables, IDictionary <string, DataFormatEntry> entries, string nullValueStrategy)
        {
            foreach (DataFormatEntry entry in entries.Values)
            {
                ColumnDescription column = new ColumnDescription(entry.DataFormatEntryName, ColumnDescription.getCategory(entry.Category), ColumnDescription.getType(entry.Type), entry.DefaultOutput, nullValueStrategy, false);
                symbolTables.addSymbolTable(column.Name, column.Category, column.Type, column.NullValueStrategy);
                columnDescriptions.Add(column);
            }
        }
예제 #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public ParseSymbolTable(String name, org.maltparser.core.symbol.SymbolTableHandler parentSymbolTableHandler) throws org.maltparser.core.exception.MaltChainedException
        public ParseSymbolTable(string name, SymbolTableHandler parentSymbolTableHandler)
        {
            this.name         = name;
            type              = SymbolTable_Fields.STRING;
            parentSymbolTable = parentSymbolTableHandler.addSymbolTable(name);
            symbolCodeMap     = new HashMap <string, int>();
            codeSymbolMap     = new HashMap <int, string>();
            symbolValueMap    = new HashMap <string, double>();
            valueCounter      = -1;
        }
예제 #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public ParseSymbolTable(String _name, int _category, int _type, String nullValueStrategy, org.maltparser.core.symbol.SymbolTableHandler parentSymbolTableHandler) throws org.maltparser.core.exception.MaltChainedException
        public ParseSymbolTable(string _name, int _category, int _type, string nullValueStrategy, SymbolTableHandler parentSymbolTableHandler)
        {
            name = _name;
            type = _type;
            parentSymbolTable = parentSymbolTableHandler.addSymbolTable(name, _category, _type, nullValueStrategy);
            symbolCodeMap     = new HashMap <string, int>();
            codeSymbolMap     = new HashMap <int, string>();
            symbolValueMap    = new HashMap <string, double>();
            valueCounter      = -1;
        }
예제 #7
0
        /// <summary>
        /// Initialize the distance feature function
        /// </summary>
        /// <param name="arguments"> an array of arguments with the type returned by getParameterTypes() </param>
        /// <exception cref="MaltChainedException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void initialize(Object[] arguments) throws org.maltparser.core.exception.MaltChainedException
        public void initialize(object[] arguments)
        {
            if (arguments.Length != 3)
            {
                throw new SyntaxGraphException("Could not initialize DistanceFeature: number of arguments is not correct. ");
            }
            // Checks that the two arguments are address functions
            if (!(arguments[0] is AddressFunction))
            {
                throw new SyntaxGraphException("Could not initialize DistanceFeature: the first argument is not an address function. ");
            }
            if (!(arguments[1] is AddressFunction))
            {
                throw new SyntaxGraphException("Could not initialize DistanceFeature: the second argument is not an address function. ");
            }
            if (!(arguments[2] is string))
            {
                throw new SyntaxGraphException("Could not initialize DistanceFeature: the third argument is not a string. ");
            }
            AddressFunction1 = (AddressFunction)arguments[0];
            AddressFunction2 = (AddressFunction)arguments[1];

            normalizationString = (string)arguments[2];
            // Creates a symbol table called "DISTANCE" using one null value
            SymbolTable = tableHandler.addSymbolTable("DISTANCE_" + normalizationString, ColumnDescription.INPUT, ColumnDescription.STRING, "one");

            string[] items = splitPattern.split(normalizationString);

            if (items.Length <= 0 || !items[0].Equals("0"))
            {
                throw new SyntaxGraphException("Could not initialize DistanceFeature (" + this + "): the third argument (normalization) must contain a list of integer values separated with | and the first element must be 0.");
            }
            int tmp = -1;

            for (int i = 0; i < items.Length; i++)
            {
                int v;
                try
                {
                    v = int.Parse(items[i]);
                }
                catch (FormatException e)
                {
                    throw new SyntaxGraphException("Could not initialize DistanceFeature (" + this + "): the third argument (normalization) must contain a sorted list of integer values separated with |", e);
                }
                normalization[v] = ">=" + v;
                table.addSymbol(">=" + v);
                if (tmp != -1 && tmp >= v)
                {
                    throw new SyntaxGraphException("Could not initialize DistanceFeature (" + this + "): the third argument (normalization) must contain a sorted list of integer values separated with |");
                }
                tmp = v;
            }
        }
예제 #8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected LWEdge(org.maltparser.core.syntaxgraph.node.Node _source, org.maltparser.core.syntaxgraph.node.Node _target, java.util.SortedMap<org.maltparser.concurrent.graph.dataformat.ColumnDescription, String> _labels) throws org.maltparser.core.exception.MaltChainedException
        protected internal LWEdge(Node _source, Node _target, SortedDictionary <ColumnDescription, string> _labels)
        {
            if (_source.BelongsToGraph != _target.BelongsToGraph)
            {
                throw new LWGraphException("The source node and target node must belong to the same dependency graph.");
            }
            source = _source;
            target = _target;
            labels = _labels;
            SymbolTableHandler symbolTableHandler = BelongsToGraph.SymbolTables;

            foreach (ColumnDescription column in labels.Keys)
            {
                SymbolTable table = symbolTableHandler.addSymbolTable(column.Name);
                table.addSymbol(labels[column]);
            }
        }
예제 #9
0
        /// <summary>
        /// Initialize the exists feature function
        /// </summary>
        /// <param name="arguments"> an array of arguments with the type returned by getParameterTypes() </param>
        /// <exception cref="MaltChainedException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void initialize(Object[] arguments) throws org.maltparser.core.exception.MaltChainedException
        public void initialize(object[] arguments)
        {
            if (arguments.Length != 1)
            {
                throw new SyntaxGraphException("Could not initialize ArcDirFeature: number of arguments are not correct. ");
            }
            // Checks that the two arguments are address functions
            if (!(arguments[0] is AddressFunction))
            {
                throw new SyntaxGraphException("Could not initialize ArcDirFeature: the first argument is not an address function. ");
            }

            AddressFunction = (AddressFunction)arguments[0];

            // Creates a symbol table called "ARCDIR" using one null value
            SymbolTable = tableHandler.addSymbolTable("ARCDIR", ColumnDescription.INPUT, ColumnDescription.STRING, "one");

            table.addSymbol("LEFT");             // The address exists
            table.addSymbol("RIGHT");            // The address don't exists
        }
예제 #10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public ColumnDescription addInternalColumnDescription(org.maltparser.core.symbol.SymbolTableHandler symbolTables, String name, int category, int type, String defaultOutput, String nullValueStrategy) throws org.maltparser.core.exception.MaltChainedException
        public virtual ColumnDescription addInternalColumnDescription(SymbolTableHandler symbolTables, string name, int category, int type, string defaultOutput, string nullValueStrategy)
        {
            if (internalColumnDescriptions == null)
            {
                internalColumnDescriptions   = new SortedDictionary <string, ColumnDescription>();
                internalColumnDescriptionSet = new SortedSet <ColumnDescription>();
            }

            if (!internalColumnDescriptions.ContainsKey(name))
            {
                ColumnDescription internalColumn = new ColumnDescription(name, category, type, defaultOutput, nullValueStrategy, true);
                symbolTables.addSymbolTable(internalColumn.Name, internalColumn.Category, internalColumn.Type, internalColumn.NullValueStrategy);
                internalColumnDescriptions[name] = internalColumn;
                internalColumnDescriptionSet.Add(internalColumn);
                return(internalColumn);
            }
            else
            {
                return(internalColumnDescriptions[name]);
            }
        }
예제 #11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void initialize(Object[] arguments) throws org.maltparser.core.exception.MaltChainedException
        public void initialize(object[] arguments)
        {
            if (arguments.Length != 2)
            {
                throw new FeatureException("Could not initialize InputArcDirFeature: number of arguments are not correct. ");
            }
            if (!(arguments[0] is string))
            {
                throw new FeatureException("Could not initialize InputArcDirFeature: the first argument is not a string. ");
            }
            if (!(arguments[1] is AddressFunction))
            {
                throw new FeatureException("Could not initialize InputArcDirFeature: the second argument is not an address function. ");
            }
            Column      = dataFormatInstance.getColumnDescriptionByName((string)arguments[0]);
            SymbolTable = tableHandler.addSymbolTable("ARCDIR_" + column.Name, ColumnDescription.INPUT, ColumnDescription.STRING, "one");
            table.addSymbol("LEFT");
            table.addSymbol("RIGHT");
            table.addSymbol("ROOT");
            AddressFunction = (AddressFunction)arguments[1];
        }
예제 #12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void addLabel(Element element, String labelFunction, String label) throws org.maltparser.core.exception.MaltChainedException
        public virtual void AddLabel(Element element, string labelFunction, string label)
        {
            element.addLabel(symbolTables.addSymbolTable(labelFunction), label);
        }