Search Results for

    Show / Hide Table of Contents

    Class Wordlist

    A searchable word list with index.

    Inheritance
    object
    Wordlist
    Implements
    ICloneable
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.Core
    Assembly: Sdl.LanguagePlatform.Core.dll
    Syntax
    public class Wordlist : ICloneable

    Constructors

    Wordlist()

    Initializes a new instance of the Wordlist class with an empty wordlist.

    Declaration
    public Wordlist()

    Wordlist(SearchOption)

    Initializes a new instance of the Wordlist class with an empty wordlist.

    Declaration
    public Wordlist(SearchOption flags)
    Parameters
    Type Name Description
    SearchOption flags

    Wordlist(Wordlist)

    Creates a new instance and deep-copies the other instance.

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

    Properties

    Count

    Returns the number of words in the word list.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    Flags

    Gets the search flags.

    Declaration
    public SearchOption Flags { get; }
    Property Value
    Type Description
    SearchOption

    Items

    Gets the list of words.

    Declaration
    public IEnumerable<string> Items { get; }
    Property Value
    Type Description
    IEnumerable<string>

    Version

    Declaration
    public int Version { get; }
    Property Value
    Type Description
    int

    Methods

    Add(string)

    Adds a new string to this wordlist if it isn't already there.

    Declaration
    public bool Add(string s)
    Parameters
    Type Name Description
    string s
    Returns
    Type Description
    bool

    true iff the word was added

    CleanupList(string, string, bool)

    Loads a word list from the specified input file, removes all duplicates, and writes the result to the output file. The two file names should not be the same. Only used internally.

    Declaration
    public static void CleanupList(string inputFileName, string outputFileName, bool ignoreComments = true)
    Parameters
    Type Name Description
    string inputFileName

    The input file name

    string outputFileName

    The output file name

    bool ignoreComments

    Ignore comments flag, if not set it is true

    Clear()

    Removes all words from the list, but keeps the flags.

    Declaration
    public void Clear()

    Clone()

    Clone()

    Declaration
    public object Clone()
    Returns
    Type Description
    object

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

    Contains(string)

    Determines whether this wordlist contains the specified string.

    Declaration
    public bool Contains(string s)
    Parameters
    Type Name Description
    string s

    The string to search for.

    Returns
    Type Description
    bool

    true if s is part of this wordlist, otherwise false.

    GetBytes()

    Returns the contents of the word list as an array of bytes. The data is UTF8-encoded. Note that search flags (such as case invariance) are not preserved.

    Declaration
    public byte[] GetBytes()
    Returns
    Type Description
    byte[]

    An array of bytes which represents the word list.

    GetRegularExpression(out CharacterSet)

    Computes a regular expression which matches the words in the list. The expression is not anchored.

    NOTE: if the word list is case insensitive, the regular expression will include the corresponding option "(?i-:)".

    Declaration
    public string GetRegularExpression(out CharacterSet first)
    Parameters
    Type Name Description
    CharacterSet first
    Returns
    Type Description
    string

    Load(byte[], bool)

    Read the word list from an array of bytes. A UTF8 encoding is assumed, but byte order marks will be honored.

    Declaration
    public void Load(byte[] data, bool ignoreComments = true)
    Parameters
    Type Name Description
    byte[] data
    bool ignoreComments

    Ignore comments flag, if not set it is true

    Load(Stream, bool)

    Adds new words to this wordlist from a stream. A UTF8 data encoding is assumed, but byte order marks will be honored.

    Declaration
    public void Load(Stream stream, bool ignoreComments = true)
    Parameters
    Type Name Description
    Stream stream

    The stream.

    bool ignoreComments

    Ignore comments flag, if not set it is true

    Load(string, bool)

    Adds new words to this wordlist from a stream. A UTF8 data encoding is assumed, but byte order marks will be honored.

    Declaration
    public void Load(string filename, bool ignoreComments = true)
    Parameters
    Type Name Description
    string filename

    The name of the file to load

    bool ignoreComments

    Ignore comments flag, if not set it is true

    Merge(Wordlist)

    Merges the contents of another instance into this word list. Note that conflicting flags and search options are ignored.

    Declaration
    public void Merge(Wordlist other)
    Parameters
    Type Name Description
    Wordlist other

    The instance to merge into this instance.

    Merge(IEnumerable<Wordlist>)

    Creates a new word list and merges all specified wordLists into the new one.

    Declaration
    public static Wordlist Merge(IEnumerable<Wordlist> wordLists)
    Parameters
    Type Name Description
    IEnumerable<Wordlist> wordLists

    The word lists to merge.

    Returns
    Type Description
    Wordlist

    The result of the merge, or null if all specified word lists are null.

    Remove(string)

    Removes s from the list.

    Declaration
    public bool Remove(string s)
    Parameters
    Type Name Description
    string s
    Returns
    Type Description
    bool

    true iff the word was removed

    Save(TextWriter)

    Saves the word list in textual format to the specified stream.

    Declaration
    public void Save(TextWriter writer)
    Parameters
    Type Name Description
    TextWriter writer

    Implements

    ICloneable
    In this article
    • Constructors
      • Wordlist()
      • Wordlist(SearchOption)
      • Wordlist(Wordlist)
    • Properties
      • Count
      • Flags
      • Items
      • Version
    • Methods
      • Add(string)
      • CleanupList(string, string, bool)
      • Clear()
      • Clone()
      • Contains(string)
      • GetBytes()
      • GetRegularExpression(out CharacterSet)
      • Load(byte[], bool)
      • Load(Stream, bool)
      • Load(string, bool)
      • Merge(Wordlist)
      • Merge(IEnumerable<Wordlist>)
      • Remove(string)
      • Save(TextWriter)
    • Implements
    Back to top Generated by DocFX