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.
Afficher le fichier Open project: abb-iss/Swum.NET Class Usage Examples

Méthodes publiques

Méthode 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 méthode

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.
Résultat void

AddFrequency() public méthode

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.
Résultat void

GetFirstFrequency() public méthode

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

GetLastFrequency() public méthode

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

GetMiddleFrequency() public méthode

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.
Résultat int

GetNounProbability() public méthode

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

GetOnlyFrequency() public méthode

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

GetTotalFrequency() public méthode

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

GetVerbProbability() public méthode

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

PositionalFrequencies() public méthode

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

PositionalFrequencies() public méthode

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.
Résultat System