Search Results for

    Show / Hide Table of Contents

    Class Wordlist

    A searchable word list with index.

    Inheritance
    System.Object
    Wordlist
    Implements
    System.ICloneable
    Inherited Members
    System.Object.ToString()
    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
    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
    System.Int32

    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
    System.Collections.Generic.IEnumerable<System.String>

    Version

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

    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
    System.String s
    Returns
    Type Description
    System.Boolean

    true iff the word was added

    CleanupList(String, String, Boolean)

    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
    System.String inputFileName

    The input file name

    System.String outputFileName

    The output file name

    System.Boolean 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()

    System.ICloneable.Clone()
    Declaration
    public object Clone()
    Returns
    Type Description
    System.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
    System.String s

    The string to search for.

    Returns
    Type Description
    System.Boolean

    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
    System.Byte[]

    An array of bytes which represents the word list.

    GetRegularExpression(out CharacterSet)

    Computes a System.Text.RegularExpressions.Regex 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
    System.String

    Load(Byte[], Boolean)

    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
    System.Byte[] data
    System.Boolean ignoreComments

    Ignore comments flag, if not set it is true

    Load(Stream, Boolean)

    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
    System.IO.Stream stream

    The stream.

    System.Boolean ignoreComments

    Ignore comments flag, if not set it is true

    Load(String, Boolean)

    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
    System.String filename

    The name of the file to load

    System.Boolean 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
    System.Collections.Generic.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
    System.String s
    Returns
    Type Description
    System.Boolean

    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
    System.IO.TextWriter writer

    Implements

    System.ICloneable

    On this page

    Back to top Generated by DocFX