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); }
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; }
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; }
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} }; }
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; }
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(); }
// 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(); }
public abstract TregexMatcher Matcher(Tree root, Tree tree, IdentityDictionary<Tree, Tree> nodesToParents, Dictionary<string, Tree> namesToNodes, VariableStrings variableStrings, IHeadFinder headFinder);