コード例 #1
0
		public virtual bool checkRootLabelCodes(LabelSet rlc)
		{
			if (rlc == null && rootLabelCodes == null)
			{
				return true; // or false ?
			}
			else if ((rlc == null && rootLabelCodes != null) || (rlc != null && rootLabelCodes == null))
			{
				return false;
			}
			else if (rlc.size() != rootLabelCodes.size())
			{
				return false;
			}
			else
			{
				foreach (SymbolTable table in rootLabelCodes.Keys)
				{
					if (!rootLabelCodes.get(table).Equals(rlc.get(table)))
					{
						return false;
					}
				}
				return true;
			}
		}
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.maltparser.core.syntaxgraph.edge.Edge moveDependencyEdge(org.maltparser.core.syntaxgraph.node.DependencyNode newHead, org.maltparser.core.syntaxgraph.node.DependencyNode dependent) throws org.maltparser.core.exception.MaltChainedException
        public virtual Edge.Edge moveDependencyEdge(DependencyNode newHead, DependencyNode dependent)
        {
            if (dependent == null || !dependent.hasHead() || newHead.BelongsToGraph != this || dependent.BelongsToGraph != this)
            {
                return(null);
            }
            Edge.Edge headEdge = dependent.HeadEdge;

            LabelSet labels = null;

            if (headEdge.Labeled)
            {
                labels = CheckOutNewLabelSet();
                foreach (SymbolTable table in headEdge.LabelTypes)
                {
                    labels.put(table, headEdge.getLabelCode(table));
                }
            }
            headEdge.clear();
            headEdge.BelongsToGraph = this;
            headEdge.setEdge((Node.Node)newHead, (Node.Node)dependent, Edge_Fields.DEPENDENCY_EDGE);
            if (labels != null)
            {
                headEdge.addLabel(labels);
                labels.clear();
                CheckInLabelSet(labels);
            }
            return(headEdge);
        }
コード例 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void removeLabels() throws org.maltparser.core.exception.MaltChainedException
        public virtual void removeLabels()
        {
            if (labelSet != null && belongsToGraph != null)
            {
                belongsToGraph.CheckInLabelSet(labelSet);
            }
            labelSet = null;
        }
コード例 #4
0
        /// <summary>
        /// Adds the labels of the label set to the label set of the graph element.
        /// </summary>
        /// <param name="labels"> a label set. </param>
        /// <exception cref="MaltChainedException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void addLabel(LabelSet labels) throws org.maltparser.core.exception.MaltChainedException
        public virtual void addLabel(LabelSet labels)
        {
            if (labels != null)
            {
                foreach (SymbolTable table in labels.Keys)
                {
                    addLabel(table, labels.get(table));
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Resets the graph element.
        /// </summary>
        /// <exception cref="MaltChainedException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void clear() throws org.maltparser.core.exception.MaltChainedException
        public virtual void clear()
        {
            if (labelSet != null && belongsToGraph != null)
            {
                belongsToGraph.CheckInLabelSet(labelSet);
            }
            labelSet = null;
            deleteObserver((SyntaxGraph)belongsToGraph);
            belongsToGraph = null;
        }
コード例 #6
0
        /// <summary>
        /// Adds a label (an integer value) to the symbol table and to the graph element.
        /// </summary>
        /// <param name="table"> the symbol table </param>
        /// <param name="code"> a label code </param>
        /// <exception cref="MaltChainedException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void addLabel(org.maltparser.core.symbol.SymbolTable table, int code) throws org.maltparser.core.exception.MaltChainedException
        public virtual void addLabel(SymbolTable table, int code)
        {
            if (!ReferenceEquals(table.getSymbolCodeToString(code), null))
            {
                if (labelSet == null)
                {
                    if (belongsToGraph == null)
                    {
                        throw new SyntaxGraphException("The graph element doesn't belong to any graph. ");
                    }
                    labelSet = belongsToGraph.CheckOutNewLabelSet();
                }
                labelSet.put(table, code);
                setChanged();
                notifyObservers(table);
            }
        }
コード例 #7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected org.maltparser.core.syntaxgraph.edge.Edge moveDependencyEdge(org.maltparser.core.syntaxgraph.node.DependencyNode newHead, org.maltparser.core.syntaxgraph.node.DependencyNode dependent) throws org.maltparser.core.exception.MaltChainedException
        protected internal virtual Edge.Edge moveDependencyEdge(DependencyNode newHead, DependencyNode dependent)
        {
            if (dependent == null || !dependent.hasHead())
            {
                return(null);
            }
            Edge.Edge headEdge = dependent.HeadEdge;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LabelSet labels = checkOutNewLabelSet();
            LabelSet labels = CheckOutNewLabelSet();

            foreach (SymbolTable table in headEdge.LabelTypes)
            {
                labels.put(table, headEdge.getLabelCode(table));
            }
            headEdge.clear();
            headEdge.BelongsToGraph = this;
            headEdge.setEdge((Node.Node)newHead, (Node.Node)dependent, Edge_Fields.DEPENDENCY_EDGE);
            headEdge.addLabel(labels);
            labels.clear();
            CheckInLabelSet(labels);
            return(headEdge);
        }
コード例 #8
0
ファイル: LabelSet.cs プロジェクト: Sojaner/NMaltParser
 public LabelSet(LabelSet labelSet) : base(labelSet)
 {
 }
コード例 #9
0
ファイル: SyntaxGraph.cs プロジェクト: Sojaner/NMaltParser
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void checkInLabelSet(LabelSet labelSet) throws org.maltparser.core.exception.MaltChainedException
        public virtual void CheckInLabelSet(LabelSet labelSet)
        {
            labelSetPool.checkIn(labelSet);
        }
コード例 #10
0
 public GraphElement()
 {
     belongsToGraph = null;
     labelSet       = null;
 }
コード例 #11
0
		public RootLabels()
		{
			rootLabelCodes = new LabelSet();
		}