C# Класс ABB.Swum.WordData.PositionalFrequencies

Encapsulates positional frequency data for words. That is, how often a word appears in a specific postition within an identifier.
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
AddFrequency ( string word, PositionalFrequencyRecord record ) : void

Stores the given frequency data for the given word. This will overwrite any existing data for that word.

AddFrequency ( string word, int first, int middle, int last, int only ) : void

Stores the given frequency data for the given word. This will overwrite any existing data for that word.

GetFirstFrequency ( string word ) : int

Returns how often the given word appears at the beginning of an identifier.

GetLastFrequency ( string word ) : int

Returns how often the given word appears at the end of an identifier.

GetMiddleFrequency ( string word ) : int

Returns how often the given word appears in the middle of an identifier, i.e. not first or last.

GetNounProbability ( string word ) : double

Calculates the probability that the given word is a noun, based on its positional frequencies.

GetOnlyFrequency ( string word ) : int

Returns how often the given word appears by itself in an identifier

GetTotalFrequency ( string word ) : int

Returns the total number of times the given word appears in an identifier.

GetVerbProbability ( string word ) : double

Calculates the probability that the given word is a verb, based on its positional frequencies.

PositionalFrequencies ( ) : System

Creates a new PositionalFrequencies object, using the positional frequency data in the default file.

PositionalFrequencies ( string filePath ) : System

Creates a new PostionalFrequencies object, using the positional frequency data in the supplied file. The file should contain a single word entry per line, in the format [word] [first-freq] [middle-freq] [last-freq] [only-freq]

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

AddFrequency() публичный метод

Stores the given frequency data for the given word. This will overwrite any existing data for that word.
public AddFrequency ( string word, PositionalFrequencyRecord record ) : void
word string The word.
record PositionalFrequencyRecord The frequency data for the word.
Результат void

AddFrequency() публичный метод

Stores the given frequency data for the given word. This will overwrite any existing data for that word.
public AddFrequency ( string word, int first, int middle, int last, int only ) : void
word string The word.
first int A count of how often the word appears at the beginning of an identifier.
middle int A count of how often the word appears in the middle of an identifier, i.e. not first or last.
last int A count of how often the word appears at the end of an identifier.
only int A count of how often the word appears by itself in an identifier.
Результат void

GetFirstFrequency() публичный метод

Returns how often the given word appears at the beginning of an identifier.
public GetFirstFrequency ( string word ) : int
word string The word.
Результат int

GetLastFrequency() публичный метод

Returns how often the given word appears at the end of an identifier.
public GetLastFrequency ( string word ) : int
word string The word.
Результат int

GetMiddleFrequency() публичный метод

Returns how often the given word appears in the middle of an identifier, i.e. not first or last.
public GetMiddleFrequency ( string word ) : int
word string The word.
Результат int

GetNounProbability() публичный метод

Calculates the probability that the given word is a noun, based on its positional frequencies.
public GetNounProbability ( string word ) : double
word string The word.
Результат double

GetOnlyFrequency() публичный метод

Returns how often the given word appears by itself in an identifier
public GetOnlyFrequency ( string word ) : int
word string The word.
Результат int

GetTotalFrequency() публичный метод

Returns the total number of times the given word appears in an identifier.
public GetTotalFrequency ( string word ) : int
word string The word.
Результат int

GetVerbProbability() публичный метод

Calculates the probability that the given word is a verb, based on its positional frequencies.
public GetVerbProbability ( string word ) : double
word string The word.
Результат double

PositionalFrequencies() публичный метод

Creates a new PositionalFrequencies object, using the positional frequency data in the default file.
public PositionalFrequencies ( ) : System
Результат System

PositionalFrequencies() публичный метод

Creates a new PostionalFrequencies object, using the positional frequency data in the supplied file. The file should contain a single word entry per line, in the format [word] [first-freq] [middle-freq] [last-freq] [only-freq]
public PositionalFrequencies ( string filePath ) : System
filePath string The path to the file with the positional frequency data.
Результат System