C# Class ABB.Swum.WordData.PositionalFrequencies

Encapsulates positional frequency data for words. That is, how often a word appears in a specific postition within an identifier.
Mostra file Open project: abb-iss/Swum.NET Class Usage Examples

Public Methods

Method Description
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]

Method Details

AddFrequency() public method

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.
return void

AddFrequency() public method

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.
return void

GetFirstFrequency() public method

Returns how often the given word appears at the beginning of an identifier.
public GetFirstFrequency ( string word ) : int
word string The word.
return int

GetLastFrequency() public method

Returns how often the given word appears at the end of an identifier.
public GetLastFrequency ( string word ) : int
word string The word.
return int

GetMiddleFrequency() public method

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.
return int

GetNounProbability() public method

Calculates the probability that the given word is a noun, based on its positional frequencies.
public GetNounProbability ( string word ) : double
word string The word.
return double

GetOnlyFrequency() public method

Returns how often the given word appears by itself in an identifier
public GetOnlyFrequency ( string word ) : int
word string The word.
return int

GetTotalFrequency() public method

Returns the total number of times the given word appears in an identifier.
public GetTotalFrequency ( string word ) : int
word string The word.
return int

GetVerbProbability() public method

Calculates the probability that the given word is a verb, based on its positional frequencies.
public GetVerbProbability ( string word ) : double
word string The word.
return double

PositionalFrequencies() public method

Creates a new PositionalFrequencies object, using the positional frequency data in the default file.
public PositionalFrequencies ( ) : System
return System

PositionalFrequencies() public method

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.
return System