IntegerText Type

Converts list of arbitrary objects into an integer array. This is done by creating an integer alphabet, which maps each unique element in the original list(s) to an integer value. The lexicographical order of the elements is maintained, i.e. when a list of elements of ascending order is mapped to an integer list, the integer list is also in ascending order.

Constructors

Constructor Description

IntegerText()

Full Usage: IntegerText()

Instance members

Instance member Description

this.AlphabetSize

Full Usage: this.AlphabetSize

Returns: int

Size of the alphabet, i.e. the number of unique elements that occur in the original text (or, number of unique list elements). If the text was separated into individual words, the number of words (= number of separator elements) also contribute to the alphabet size.

Returns: int

this.NumberOfWords

Full Usage: this.NumberOfWords

Returns: int

Number of words, if the text was separated into individual words. Otherwise, this field is equal to one.

Returns: int

this.PaddingLength

Full Usage: this.PaddingLength

Returns: int

Number of additional elements of array IntegerText.Text. Thus the length of this array is IntegerText.PaddingLength + IntegerText.TextLength

Returns: int

this.Text

Full Usage: this.Text

Returns: int[]

Original text, converted to an integer alphabet. Each unique element of the original text (or each unique list element) corresponds to an integer value. The order of this integer alphabet is the same as the order of the original elements. Note that the value 0 is reserved for the internal algorithm. If the original text was separated in different words, the first numberOfWords integers (1..numberOfWords) are reserved as separator elements, too.

Returns: int[]

this.TextLength

Full Usage: this.TextLength

Returns: int

Length of the text. This is the total length of the original text, plus, if the text was separated into words, the number of separator elements (which is equal to the number of words). Note that the array IntegerText._text is needed to be longer than IntegerText._textLength, since some additional elements are neccessary for most algorithms.

Returns: int

this.WordStartPositions

Full Usage: this.WordStartPositions

Returns: int[]

Start positions of the words in which the original text was separated in the array IntegerText._text.

Returns: int[]

Static members

Static member Description

IntegerText.FromWords(words, withSeparators, padding, customComparer)

Full Usage: IntegerText.FromWords(words, withSeparators, padding, customComparer)

Parameters:
    words : IEnumerable<string> - The list of individual words.
    withSeparators : bool - If set to true, the converted text will contain the concenated 'words', separated by special separator elements. If set to false, the converted text will contain the concenated 'words' without separator elements.
    padding : int - Number of additional elements reserved in the allocated IntegerText.Text array. This is neccessary for some algorithms. The additional elements will contain zero values.
    customComparer : IComparer<char> - Provides a custom comparer. If you don't want to provide an own comparer, leave this argument null.

Returns: IntegerText The integer text data, which holds the text converted to an integer alphabet.

Generates an integer text from words (= a collection of strings). The algorithm determines the lexicographical order of all elements in all lists and then maps each unique element to an integer value, with increasing values in the lexicographical order of the elements.

words : IEnumerable<string>

The list of individual words.

withSeparators : bool

If set to true, the converted text will contain the concenated 'words', separated by special separator elements. If set to false, the converted text will contain the concenated 'words' without separator elements.

padding : int

Number of additional elements reserved in the allocated IntegerText.Text array. This is neccessary for some algorithms. The additional elements will contain zero values.

customComparer : IComparer<char>

Provides a custom comparer. If you don't want to provide an own comparer, leave this argument null.

Returns: IntegerText

The integer text data, which holds the text converted to an integer alphabet.

IntegerText.FromWords(lists, withSeparators, padding, useSortedMapping, customSortingComparer)

Full Usage: IntegerText.FromWords(lists, withSeparators, padding, useSortedMapping, customSortingComparer)

Parameters:
    lists : IEnumerable<IEnumerable<'T>> - The list of individual words.
    withSeparators : bool - If set to true, the converted text will contain the concenated 'words', separated by special separator elements. If set to false, the converted text will contain the concenated 'words' without separator elements.
    padding : int - Number of additional elements reserved in the allocated IntegerText.Text array. This is neccessary for some algorithms. The additional elements will contain zero values.
    useSortedMapping : bool - If this parameter is true, a sorted mapping of the elements T to integers will be used. The type T then has to implement IComparable. If this parameter is false, a unsorted HashSet will be used to make a unique mapping of the elements to integers.
    customSortingComparer : IComparer<'T> - If useSortedMapping is true, you can here provide a custom comparer for the elements of type T. Otherwise, if you want to use the default comparer, leave this parameter null.

Returns: IntegerText The integer text data, which holds the text converted to an integer alphabet.

Generates an integer text from arbitrary elements. Each list in lists is treated as separate word. Each element is such a list is treated as character. The algorithm determines the lexicographical order of all elements in all lists and then maps each unique element to an integer value, with increasing values in the lexicographical order of the elements. A unique mapping is even possible, if the elements are not sortable (i.e. if they not implement IComparable).

lists : IEnumerable<IEnumerable<'T>>

The list of individual words.

withSeparators : bool

If set to true, the converted text will contain the concenated 'words', separated by special separator elements. If set to false, the converted text will contain the concenated 'words' without separator elements.

padding : int

Number of additional elements reserved in the allocated IntegerText.Text array. This is neccessary for some algorithms. The additional elements will contain zero values.

useSortedMapping : bool

If this parameter is true, a sorted mapping of the elements T to integers will be used. The type T then has to implement IComparable. If this parameter is false, a unsorted HashSet will be used to make a unique mapping of the elements to integers.

customSortingComparer : IComparer<'T>

If useSortedMapping is true, you can here provide a custom comparer for the elements of type T. Otherwise, if you want to use the default comparer, leave this parameter null.

Returns: IntegerText

The integer text data, which holds the text converted to an integer alphabet.