Search Results for

    Show / Hide Table of Contents

    Class SegmentationRule

    A segmentation rule consist of at least one "positive" SegmentationContext (the matching context) and a possibly empty set of exceptions.

    A segmentation rule "fires" if the matching context matches a specified position, and either the exception list is empty or none of the exceptions matches the same position in the input.

    Inheritance
    System.Object
    SegmentationRule
    Implements
    System.ICloneable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.Core.Segmentation
    Assembly: Sdl.LanguagePlatform.Core.dll
    Syntax
    public class SegmentationRule : ICloneable

    Constructors

    SegmentationRule()

    Initializes a new instance with default values. This constructor is required for XML deserialization and should not be used directly.

    Declaration
    public SegmentationRule()

    SegmentationRule(SegmentationRule)

    Initializes a new instance with the values of another instance, creating a deep copy.

    Declaration
    public SegmentationRule(SegmentationRule other)
    Parameters
    Type Name Description
    SegmentationRule other

    The other instance

    SegmentationRule(String, SegmentationContext)

    Initializes a new instance with the specified values.

    Declaration
    public SegmentationRule(string description, SegmentationContext matchingContext)
    Parameters
    Type Name Description
    System.String description

    A description of the rule, for display purposes.

    SegmentationContext matchingContext

    The matching context for this segmentation rule.

    SegmentationRule(String, SegmentationContext, List<SegmentationContext>)

    Initializes a new instance with the specified values.

    Declaration
    public SegmentationRule(string description, SegmentationContext matchingContext, List<SegmentationContext> exceptions)
    Parameters
    Type Name Description
    System.String description

    A description of the rule, for display purposes.

    SegmentationContext matchingContext

    The matching context for this segmentation rule.

    System.Collections.Generic.List<SegmentationContext> exceptions

    A list of exceptions to attach to the matching context (optional)

    Properties

    Description

    Gets or sets the description of this rule.

    Declaration
    public LocalizedString Description { get; set; }
    Property Value
    Type Description
    LocalizedString

    Exceptions

    Gets or sets the exceptions for this rule.

    Declaration
    public List<SegmentationContext> Exceptions { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<SegmentationContext>

    IsEnabled

    Gets or sets a flag to control whether this rule is currently enabled. Note that not all clients evaluate this flag yet, and all rules (whether enabled or not) may be used during segmentation.

    Declaration
    public bool IsEnabled { get; set; }
    Property Value
    Type Description
    System.Boolean

    MatchingContext

    Gets or sets the matching context for this rule (non-null).

    Declaration
    public SegmentationContext MatchingContext { get; set; }
    Property Value
    Type Description
    SegmentationContext

    MinimumChars

    The minimum number of chars a segment must have.

    Currently not yet supported

    Declaration
    public int MinimumChars { get; set; }
    Property Value
    Type Description
    System.Int32

    MinimumWords

    The minimum number of words a segment must have.

    Currently not yet supported

    Declaration
    public int MinimumWords { get; set; }
    Property Value
    Type Description
    System.Int32

    Origin

    Gets or sets the origin of this rule. This is used for display and system purposes. The value should not be modified after a rule has been created or obtained.

    Declaration
    public RuleOrigin Origin { get; set; }
    Property Value
    Type Description
    RuleOrigin

    Type

    Gets or sets the rule type, which is used for display purposes. This value must match the rule's break character and should not be modified after a rule has been created or obtained.

    Declaration
    public RuleType Type { get; set; }
    Property Value
    Type Description
    RuleType

    Methods

    AddException(SegmentationContext)

    Adds the provided exception to the list of exceptions.

    Declaration
    public void AddException(SegmentationContext context)
    Parameters
    Type Name Description
    SegmentationContext context

    The exception to add to the rule (non-null)

    Clone()

    System.ICloneable.Clone()
    Declaration
    public object Clone()
    Returns
    Type Description
    System.Object

    A new object that is a deep copy of this instance.

    FindFirstMatch(String, Int32, Boolean, Boolean)

    Finds the first matche of the rule in the input string, starting at the specified position.

    Declaration
    public int FindFirstMatch(string input, int startOffset, bool assumeEof, bool followedByWordBreak)
    Parameters
    Type Name Description
    System.String input

    The input string to test

    System.Int32 startOffset

    The zero-based position in the input to start the match process from

    System.Boolean assumeEof

    If true, it is assumed that the end of input has been reached, and end-of-input constraints will match at the end of the input string. If false, any end-of-input constraints will not match.

    System.Boolean followedByWordBreak

    If true, any end-of-word constraints will match at the end of the input string. If false, no end-of-word constraints will match.

    Returns
    Type Description
    System.Int32

    The first position in the input where the rule matches, or -1 if no match was found.

    MatchesAt(String, Int32, Boolean, Boolean)

    Tests whether the context matches at the specified position. The preceding context, if specified, must match up to the position (not including), and the following context must match from that position onwards. If true, a match is postulated directly before position.

    Declaration
    public bool MatchesAt(string input, int position, bool assumeEof, bool followedByWordBreak)
    Parameters
    Type Name Description
    System.String input

    The input string to test

    System.Int32 position

    The position in the input to test for a match

    System.Boolean assumeEof

    If true, it is assumed that the end of input has been reached, and end-of-input constraints will match. If false, any end-of-input constraints will not match.

    System.Boolean followedByWordBreak

    If true, any end-of-word constraints will match. If false, no end-of-word constraints will match.

    Returns
    Type Description
    System.Boolean

    true iff the preceding context matches up to the specified position (non-inclusive), and the following context matches from that position onwards.

    ToString()

    System.Object.ToString()
    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A string representation of the object, for display purposes.

    Overrides
    System.Object.ToString()

    Implements

    System.ICloneable

    On this page

    • Constructors
      • SegmentationRule()
      • SegmentationRule(SegmentationRule)
      • SegmentationRule(String, SegmentationContext)
      • SegmentationRule(String, SegmentationContext, List<SegmentationContext>)
    • Properties
      • Description
      • Exceptions
      • IsEnabled
      • MatchingContext
      • MinimumChars
      • MinimumWords
      • Origin
      • Type
    • Methods
      • AddException(SegmentationContext)
      • Clone()
      • FindFirstMatch(String, Int32, Boolean, Boolean)
      • MatchesAt(String, Int32, Boolean, Boolean)
      • ToString()
    • Implements
    Back to top Generated by DocFX