C# Класс ABB.Swum.Utilities.LibFileLoader

Contains various utility functions for loading library data files.
Показать файл Открыть проект

Открытые методы

Метод Описание
ReadStemFile ( string path ) : string>.Dictionary

Reads a word stem file and parses it into a dictionary. The file is assumed to contain one entry per line, with each entry of the format "[word] [stem]". If the file contains duplicate entries for a given word, only the last entry will be in the dictionary.

ReadVerbParticleFile ( string path ) : HashSet>.Dictionary

Reads the verb particle file at the given path and reads it into a Dictionary. Each line of the file should be in the format: [verb] [particle]. The returned Dictionary maps a particle to a set of verbs.

ReadWordCount ( string path ) : int>.Dictionary

Reads a word count file and parses it into a dictionary. The file is assumed to contain one entry per line, with each entry of the format "[count] [word]". Count must be a non-negative whole number. If the file contains duplicate entries for a given word, only the last entry will be in the dictionary. Words are converted to lower case before being added to the dictionary.

ReadWordCount ( string path, bool keepOriginalCasing ) : int>.Dictionary

Reads a word count file and parses it into a dictionary. The file is assumed to contain one entry per line, with each entry of the format "[count] [word]". Count must be a non-negative whole number. If the file contains duplicate entries for a given word, only the last entry will be in the dictionary. Words are converted to lower case before being added to the dictionary.

ReadWordCount ( string path, bool keepOriginalCase, Func includeFunction ) : int>.Dictionary

Reads a word count file and parses it into a dictionary. The file is assumed to contain one entry per line, with each entry of the format "[count] [word]". Count must be a non-negative whole number. If the file contains duplicate entries for a given word, only the last entry will be in the dictionary.

ReadWordList ( ) : HashSet

Reads a file containing a list of words, and returns it as a set. The file is assumed to contain a single word on each line. Duplicate words will be ignored. Words are converted to lower case before being added.

ReadWordList ( bool keepOriginalCase ) : HashSet

Reads a file containing a list of words, and returns it as a set. The file is assumed to contain a single word on each line. Duplicate words will be ignored.

WriteWordCount ( int>.Dictionary wordCount, string path ) : void

Writes a word count dictionary to a file. Each dictionary entry is written in the format "[count] [word]".

Описание методов

ReadStemFile() публичный статический Метод

Reads a word stem file and parses it into a dictionary. The file is assumed to contain one entry per line, with each entry of the format "[word] [stem]". If the file contains duplicate entries for a given word, only the last entry will be in the dictionary.
public static ReadStemFile ( string path ) : string>.Dictionary
path string The file to read.
Результат string>.Dictionary

ReadVerbParticleFile() публичный статический Метод

Reads the verb particle file at the given path and reads it into a Dictionary. Each line of the file should be in the format: [verb] [particle]. The returned Dictionary maps a particle to a set of verbs.
public static ReadVerbParticleFile ( string path ) : HashSet>.Dictionary
path string The verb particle file to read.
Результат HashSet>.Dictionary

ReadWordCount() публичный статический Метод

Reads a word count file and parses it into a dictionary. The file is assumed to contain one entry per line, with each entry of the format "[count] [word]". Count must be a non-negative whole number. If the file contains duplicate entries for a given word, only the last entry will be in the dictionary. Words are converted to lower case before being added to the dictionary.
public static ReadWordCount ( string path ) : int>.Dictionary
path string The file to read.
Результат int>.Dictionary

ReadWordCount() публичный статический Метод

Reads a word count file and parses it into a dictionary. The file is assumed to contain one entry per line, with each entry of the format "[count] [word]". Count must be a non-negative whole number. If the file contains duplicate entries for a given word, only the last entry will be in the dictionary. Words are converted to lower case before being added to the dictionary.
public static ReadWordCount ( string path, bool keepOriginalCasing ) : int>.Dictionary
path string The file to read.
keepOriginalCasing bool If True, words are added to the dictionary in their original case. If False, words are converted to lower case.
Результат int>.Dictionary

ReadWordCount() публичный статический Метод

Reads a word count file and parses it into a dictionary. The file is assumed to contain one entry per line, with each entry of the format "[count] [word]". Count must be a non-negative whole number. If the file contains duplicate entries for a given word, only the last entry will be in the dictionary.
public static ReadWordCount ( string path, bool keepOriginalCase, Func includeFunction ) : int>.Dictionary
path string The file to read.
keepOriginalCase bool If True, words are added to the dictionary in their original case. If False, words are converted to lower case.
includeFunction Func A function specifying whether or not to include a given entry from the file. /// This takes a string and uint as parameters and returns True if the entry should be included and False otherwise.
Результат int>.Dictionary

ReadWordList() публичный статический Метод

Reads a file containing a list of words, and returns it as a set. The file is assumed to contain a single word on each line. Duplicate words will be ignored. Words are converted to lower case before being added.
public static ReadWordList ( ) : HashSet
Результат HashSet

ReadWordList() публичный статический Метод

Reads a file containing a list of words, and returns it as a set. The file is assumed to contain a single word on each line. Duplicate words will be ignored.
public static ReadWordList ( bool keepOriginalCase ) : HashSet
keepOriginalCase bool If True, words are added to the set in their original case. If False, words are converted to lower case.
Результат HashSet

WriteWordCount() публичный статический Метод

Writes a word count dictionary to a file. Each dictionary entry is written in the format "[count] [word]".
public static WriteWordCount ( int>.Dictionary wordCount, string path ) : void
wordCount int>.Dictionary The word count dictionary to write.
path string The file to write to.
Результат void