Search Results for

    Show / Hide Table of Contents

    Class WordCounts

    Represents the result of a word count.

    Inheritance
    object
    WordCounts
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.TranslationMemory
    Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
    Syntax
    [DataContract]
    public class WordCounts

    Constructors

    WordCounts()

    Initializes a new instance with default values. All counts will be set to 0.

    Declaration
    public WordCounts()

    WordCounts(WordCounts)

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

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

    The instance to copy

    WordCounts(IList<Token>)

    Initializes a new instance from the values in the provided token collection.

    • Word and abbreviation tokens increment the character count by the length of the token text and increment the word count by one,
    • Char sequence tokens (used in far-east tokenization) increment the word and character count by the length of the token text,
    • Punctuation tokens only increment the character count, by the length of the token text,
    • Date, time, variable, number, measurement, acronym, uri, and other text placeable tokens increment the word and character count like words do, but also increment the placeables count,
    • Tag tokens increment the tag and placeable counts, but not the word or character counts,
    • Whitespace tokens do not increment any counts (even not the character count),
    • All other token types do not increment any counts.
    • The segment count is set to 1, independent on the number and type of the tokens.
    Declaration
    public WordCounts(IList<Token> tokens)
    Parameters
    Type Name Description
    IList<Token> tokens

    The token collection

    WordCounts(IList<Token>, WordCountsOptions, CultureCode)

    Declaration
    [Obsolete("Use WordCounter")]
    public WordCounts(IList<Token> tokens, WordCountsOptions options, CultureCode culture)
    Parameters
    Type Name Description
    IList<Token> tokens
    WordCountsOptions options
    CultureCode culture

    WordCounts(IList<Token>, bool, bool, bool, bool)

    Initializes a new instance from the values in the provided token collection.

    • Word and abbreviation tokens increment the character count by the length of the token text and increment the word count by one,
    • Char sequence tokens (used in far-east tokenization) increment the word and character count by the length of the token text,
    • Punctuation tokens only increment the character count, by the length of the token text,
    • Date, time, variable, number, measurement, acronym, uri, and other text placeable tokens increment the word and character count like words do, but also increment the placeables count,
    • Tag tokens increment the tag and placeable counts, but not the word or character counts,
    • Whitespace tokens do not increment any counts (even not the character count),
    • All other token types do not increment any counts.
    • The segment count is set to 1, independent on the number and type of the tokens.
    Declaration
    public WordCounts(IList<Token> tokens, bool breakOnHyphen, bool breakOnDash, bool breakOnTag, bool breakOnApostrophe)
    Parameters
    Type Name Description
    IList<Token> tokens

    The token collection

    bool breakOnHyphen

    If false, 2 words separated by a hyphen count as 1

    bool breakOnDash

    If false, 2 words separated by a dash count as 1

    bool breakOnTag

    If false, 2 words separated by a formatting tag count as 1

    bool breakOnApostrophe

    If false, 2 words separated by an apostrophe count as 1

    Properties

    Characters

    Gets or sets the character count.

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

    IsZero

    Gets a boolean value which indicates whether all count values are zero or not.

    Declaration
    public bool IsZero { get; }
    Property Value
    Type Description
    bool

    Placeables

    Gets or sets the placeable count.

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

    Segments

    Gets or sets the segment count.

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

    Tags

    Gets or sets the tag count.

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

    Words

    Gets or sets the word count.

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

    Methods

    Assign(WordCounts)

    Overwrites the count values of this instance with the values of another instance.

    Declaration
    public void Assign(WordCounts other)
    Parameters
    Type Name Description
    WordCounts other

    The instance which values to assign to this instance

    CreateWordCountsAsync(IList<Token>, WordCountsOptions, CultureCode, ICultureMetadataManager)

    Declaration
    [Obsolete("Use WordCounter")]
    public static Task<WordCounts> CreateWordCountsAsync(IList<Token> tokens, WordCountsOptions options, CultureCode cultureCode, ICultureMetadataManager cultureMetadataManager)
    Parameters
    Type Name Description
    IList<Token> tokens
    WordCountsOptions options
    CultureCode cultureCode
    ICultureMetadataManager cultureMetadataManager
    Returns
    Type Description
    Task<WordCounts>

    Duplicate()

    Creates a new instance that is a deep copy of this instance.

    Declaration
    public WordCounts Duplicate()
    Returns
    Type Description
    WordCounts

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

    Inc(WordCounts)

    Increments the count values of this instance with the count values of another instance.

    Declaration
    public void Inc(WordCounts other)
    Parameters
    Type Name Description
    WordCounts other

    The other instance

    In this article
    • Constructors
      • WordCounts()
      • WordCounts(WordCounts)
      • WordCounts(IList<Token>)
      • WordCounts(IList<Token>, WordCountsOptions, CultureCode)
      • WordCounts(IList<Token>, bool, bool, bool, bool)
    • Properties
      • Characters
      • IsZero
      • Placeables
      • Segments
      • Tags
      • Words
    • Methods
      • Assign(WordCounts)
      • CreateWordCountsAsync(IList<Token>, WordCountsOptions, CultureCode, ICultureMetadataManager)
      • Duplicate()
      • Inc(WordCounts)
    Back to top Generated by DocFX