public static void SetOffsetBottom(this IHasOffset offset, float bottom) { var o = offset.Offset; o.Bottom = bottom; offset.Offset = o; }
public static void SetOffsetHorizontal(this IHasOffset offset, float horizontal) { var o = offset.Offset; o.Horizontal = horizontal; offset.Offset = o; }
public static void SetOffsetVertical(this IHasOffset offset, float vertical) { var o = offset.Offset; o.Vertical = vertical; offset.Offset = o; }
public static void SetOffsetRight(this IHasOffset offset, float right) { var o = offset.Offset; o.Right = right; offset.Offset = o; }
public static void SetOffsetTop(this IHasOffset offset, float top) { var o = offset.Offset; o.Top = top; offset.Offset = o; }
public static void SetOffsetLeft(this IHasOffset offset, float left) { var o = offset.Offset; o.Left = left; offset.Offset = o; }
public static void SetOffsetHorizontal(this IHasOffset offset, float left, float right) { var o = offset.Offset; o.Left = left; o.Right = right; offset.Offset = o; }
public static void SetOffsetVertical(this IHasOffset offset, float top, float bottom) { var o = offset.Offset; o.Top = top; o.Bottom = bottom; offset.Offset = o; }
/// <summary> /// Create a new <code>StringLabel</code> with the /// <code>value()</code> of another label as its label. /// </summary> /// <param name="label">The other label</param> public StringLabel(ILabel label) { this.str = label.Value(); if (label is IHasOffset) { IHasOffset ofs = (IHasOffset)label; SetBeginPosition(ofs.BeginPosition()); SetEndPosition(ofs.EndPosition()); } }
internal virtual List <TaggedWord> GetTaggedSentence() { bool hasOffset; hasOffset = origWords != null && origWords.Count > 0 && (origWords[0] is IHasOffset); List <TaggedWord> taggedSentence = new List <TaggedWord>(); for (int j = 0; j < size - 1; j++) { string tag = finalTags[j]; TaggedWord w = new TaggedWord(sent[j], tag); if (hasOffset) { IHasOffset offset = (IHasOffset)origWords[j]; w.SetBeginPosition(offset.BeginPosition()); w.SetEndPosition(offset.EndPosition()); } taggedSentence.Add(w); } return(taggedSentence); }
public SMCBlockRef(IHasOffset target, IHasOffset relBase, uint key) : base(target, relBase) { Key = key; }
public ILRelReference(IHasOffset target, IHasOffset relBase) { this.Target = target; this.Base = relBase; }
/// <summary>Finds the nearest delimiter starting from index start.</summary> /// <remarks> /// Finds the nearest delimiter starting from index start. If <tt>seekDir</tt> /// is SEEK_FORWARD, finds the nearest delimiter after start. Else, if it is /// SEEK_BACK, finds the nearest delimiter before start. /// </remarks> private int NearestDelimiter(string text, int start, int seekDir) { if (seekDir != SeekBack && seekDir != SeekForward) { throw new ArgumentException("Unknown seek direction " + seekDir); } StringReader reader = new StringReader(text); DocumentPreprocessor processor = new DocumentPreprocessor(reader); ITokenizerFactory <IHasWord> tf = tlp.GetTokenizerFactory(); processor.SetTokenizerFactory(tf); IList <int> boundaries = new List <int>(); foreach (IList <IHasWord> sentence in processor) { if (sentence.Count == 0) { continue; } if (!(sentence[0] is IHasOffset)) { throw new InvalidCastException("Expected HasOffsets from the " + "DocumentPreprocessor"); } if (boundaries.Count == 0) { boundaries.Add(0); } else { IHasOffset first = (IHasOffset)sentence[0]; boundaries.Add(first.BeginPosition()); } } boundaries.Add(text.Length); for (int i = 0; i < boundaries.Count - 1; ++i) { if (boundaries[i] <= start && start < boundaries[i + 1]) { if (seekDir == SeekBack) { return(boundaries[i] - 1); } else { if (seekDir == SeekForward) { return(boundaries[i + 1] - 1); } } } } // The cursor position at the end is actually one past the text length. // We might as well highlight the last interval in that case. if (boundaries.Count >= 2 && start >= text.Length) { if (seekDir == SeekBack) { return(boundaries[boundaries.Count - 2] - 1); } else { if (seekDir == SeekForward) { return(boundaries[boundaries.Count - 1] - 1); } } } return(-1); }
public ILRelReference(IHasOffset target, IHasOffset relBase) { Target = target; Base = relBase; }