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
    object
    SegmentationRule
    Implements
    ICloneable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.Core.Segmentation
    Assembly: Sdl.LanguagePlatform.Core.dll
    Syntax
    [DataContract]
    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
    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
    string description

    A description of the rule, for display purposes.

    SegmentationContext matchingContext

    The matching context for this segmentation rule.

    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
    [DataMember]
    public LocalizedString Description { get; set; }
    Property Value
    Type Description
    LocalizedString

    Exceptions

    Gets or sets the exceptions for this rule.

    Declaration
    [DataMember]
    public List<SegmentationContext> Exceptions { get; set; }
    Property Value
    Type Description
    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
    [DataMember]
    public bool IsEnabled { get; set; }
    Property Value
    Type Description
    bool

    MatchingContext

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

    Declaration
    [DataMember]
    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
    [DataMember]
    public int MinimumChars { get; set; }
    Property Value
    Type Description
    int

    MinimumWords

    The minimum number of words a segment must have.

    Currently not yet supported

    Declaration
    [DataMember]
    public int MinimumWords { get; set; }
    Property Value
    Type Description
    int

    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
    [DataMember]
    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
    [DataMember]
    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()

    Clone()

    Declaration
    public object Clone()
    Returns
    Type Description
    object

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

    FindAllMatches(string, int, bool, bool)

    Declaration
    public List<int> FindAllMatches(string input, int startOffset, bool assumeEof, bool followedByWordBreak)
    Parameters
    Type Name Description
    string input
    int startOffset
    bool assumeEof
    bool followedByWordBreak
    Returns
    Type Description
    List<int>

    FindFirstMatch(string, int, bool, bool)

    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
    string input

    The input string to test

    int startOffset

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

    bool 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.

    bool 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
    int

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

    MatchesAt(string, int, bool, bool)

    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
    string input

    The input string to test

    int position

    The position in the input to test for a match

    bool 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.

    bool followedByWordBreak

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

    Returns
    Type Description
    bool

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

    ToString()

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string representation of the object, for display purposes.

    Overrides
    object.ToString()

    Implements

    ICloneable
    In this article
    • 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()
      • FindAllMatches(string, int, bool, bool)
      • FindFirstMatch(string, int, bool, bool)
      • MatchesAt(string, int, bool, bool)
      • ToString()
    • Implements
    Back to top Generated by DocFX