/// <remarks> /// Constraint: Implicit suffixes must have BeginIndex < words[wordNum].Length /// </remarks> public void Canonicalize() { if (IsImplicit) { bool haveValuesChanged = false; StringBuilder sb = new StringBuilder(); sb.AppendLine(" Canonicalize: Entering"); // sb.AppendLine(tree.ToString()); int origNodeId, begin, end; origNodeId = this.OriginNode.Id; begin = this.beginIndex; end = this.endIndex; GstEdge edge = OriginNode.GetChildEdge(tree.GetWordChar(WordNum, BeginIndex)); while (edge.Span() <= Span) { sb.Append(String.Format( " Canonicalize: Active suffix changed from {0:s}", ToSuffixString(origNodeId, begin, end))); this.beginIndex += edge.Span() + 1; this.OriginNode = edge.ChildNode; haveValuesChanged = true; sb.AppendLine(String.Format(" to {0:s}", ToSuffixString(OriginNode.Id, beginIndex, endIndex))); if (Span >= 0) { edge = edge.ChildNode.GetChildEdge(tree.GetWordChar(0, BeginIndex)); } } sb.AppendLine(" Canonicalize: Exiting"); if (haveValuesChanged) { GstUtil.Write(GstVerbosityLevel.Verbose, sb.ToString()); } } }
public static void WriteLine(GstVerbosityLevel v, string message) { GstUtil.Write(v, message + Environment.NewLine); }