示例#1
0
 public override TregexMatcher Matcher(Tree root, Tree tree,
     IdentityDictionary<Tree, Tree> nodesToParents,
     Dictionary<string, Tree> namesToNodes,
     VariableStrings variableStrings,
     IHeadFinder headFinder)
 {
     return new CoordinationMatcher(this, root, tree, nodesToParents, namesToNodes, variableStrings, headFinder);
 }
示例#2
0
 private AuxiliaryTree(Tree tree, Tree foot, Dictionary<string, Tree> namesToNodes, string originalTreeString)
 {
     this.originalTreeString = originalTreeString;
     this.Tree = tree;
     this.Foot = foot;
     this.pnamesToNodes = namesToNodes;
     nodesToNames = null;
 }
示例#3
0
 public TregexMatcher(Tree root, Tree tree, IdentityDictionary<Tree, Tree> nodesToParents,
     Dictionary<string, Tree> namesToNodes, VariableStrings variableStrings, IHeadFinder headFinder)
 {
     this.root = root;
     this.tree = tree;
     this.nodesToParents = nodesToParents;
     this.namesToNodes = namesToNodes;
     this.variableStrings = variableStrings;
     this.headFinder = headFinder;
 }
示例#4
0
 public AuxiliaryTree(Tree tree, bool mustHaveFoot)
 {
     originalTreeString = tree.ToString();
     this.Tree = tree;
     this.Foot = FindFootNode(tree);
     if (Foot == null && mustHaveFoot)
     {
         throw new TsurgeonParseException("Error -- no foot node found for " + originalTreeString);
     }
     pnamesToNodes = new Dictionary<string, Tree>();
     nodesToNames = new IdentityDictionary<Tree, string>();
     InitializeNamesNodesMaps(tree);
 }
	    private void  InitBlock()
	    {
	        sizes = new IdentityDictionary<Type, int>()
	                    {
	                        {typeof (bool), 1},
	                        {typeof (byte), 1},
                            {typeof(sbyte), 1},
	                        {typeof (char), 2},
	                        {typeof (short), 2},
	                        {typeof (int), 4},
	                        {typeof (float), 4},
	                        {typeof (double), 8},
	                        {typeof (long), 8}
	                    };
	    }
示例#6
0
 public Tree GetParent(Tree node)
 {
     if (node is IHasParent)
     {
         return node.Parent();
     }
     if (nodesToParents == null)
     {
         nodesToParents = new IdentityDictionary<Tree, Tree>();
     }
     if (nodesToParents.Count == 0)
     {
         FillNodesToParents(root, null);
     }
     Tree parent;
     nodesToParents.TryGetValue(node, out parent);
     return parent;
 }
示例#7
0
 public DescriptionMatcher(DescriptionPattern n, Tree root, Tree tree,
     IdentityDictionary<Tree, Tree> nodesToParents,
     Dictionary<string, Tree> namesToNodes,
     VariableStrings variableStrings,
     IHeadFinder headFinder) :
         base(root, tree, nodesToParents, namesToNodes, variableStrings, headFinder)
 {
     myNode = n;
     // no need to reset anything - everything starts out as null or false.  
     // lazy initialization of children to save time.
     // resetChildIter();
 }
示例#8
0
            // do all con/dis-juncts have to be considered to determine a match?
            // i.e. true if conj and not negated or disj and negated

            public CoordinationMatcher(CoordinationPattern n, Tree root, Tree tree,
                IdentityDictionary<Tree, Tree> nodesToParents,
                Dictionary<string, Tree> namesToNodes,
                VariableStrings variableStrings,
                IHeadFinder headFinder) :
                    base(root, tree, nodesToParents, namesToNodes, variableStrings, headFinder)
            {
                myNode = n;
                children = new TregexMatcher[myNode.children.Count];
                // lazy initialize the children... don't set children[i] yet

                //for (int i = 0; i < children.length; i++) {
                //  TregexPattern node = myNode.children.get(i);
                //  children[i] = node.matcher(root, tree, nodesToParents,
                //                             namesToNodes, variableStrings);
                //}
                currChild = 0;
                considerAll = myNode.isConj ^ myNode.IsNegated();
            }
示例#9
0
 public abstract TregexMatcher Matcher(Tree root, Tree tree,
     IdentityDictionary<Tree, Tree> nodesToParents,
     Dictionary<string, Tree> namesToNodes,
     VariableStrings variableStrings,
     IHeadFinder headFinder);