C# Класс ABB.Swum.UnigramMethodRule

Base class for unigram-style SWUM rules for methods.
Наследование: UnigramRule
Показать файл Открыть проект

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

Метод Описание
InClass ( ProgramElementNode node ) : bool

Determines whether the given node satisfies this rule. ** Note that calling this method has the effect of stripping any preamble from the given node, and tagging any digits and prepositions. **

UnigramMethodRule ( ) : System

Creates a new UnigramMethodRule using default values for data sets.

UnigramMethodRule ( HashSet specialWords, HashSet booleanArgumentVerbs, HashSet nounPhraseIndicators, PositionalFrequencies positionalFrequencies ) : System

Creates a new UnigramMethodRule.

UnigramMethodRule ( PartOfSpeechData posData, Tagger tagger, IdSplitter splitter ) : System

Creates a new UnigramMethodRule.

UnigramMethodRule ( PartOfSpeechData posData, Tagger tagger, IdSplitter splitter, HashSet specialWords, HashSet booleanArgumentVerbs, HashSet nounPhraseIndicators, PositionalFrequencies positionalFrequencies ) : System

Creates a new UnigramMethodRule.

Защищенные методы

Метод Описание
IsChecker ( string word ) : bool

Determines whether the given word indicates a checker method.

IsEventHandler ( IEnumerable formalParameters ) : bool

Determines whether a method is an event handler based upon its formal parameters.

IsEventHandler ( PhraseNode parsedName ) : bool

Determines whether the given phrase indicates an event handler method.

IsNonBaseVerb ( string word ) : bool

Determines whether the given word is a non-base verb, i.e. present/past participle or past tense.

IsSpecialCase ( string word ) : bool

Determines whether the given word indicates a method that needs special handling.

MakeClassification ( MethodDeclarationNode node ) : bool

Performs further rule testing beyond the InClass method. InClass tests whether the node is a MethodDeclarationNode, parses the node name, strips the preamble, tags digits and prepositions, then calls this method.

ParseBaseVerbName ( MethodDeclarationNode node ) : void

Assigns part-of-speech tags to the words in the given MethodDeclarationNode's name, assuming that it follows a base verb pattern. This assumes that the node has already had its name split and preamble stripped.

ParseReactiveName ( MethodDeclarationNode mdn ) : void

Assigns part-of-speech tags, and sets Action, Theme and Arguments for methods that have a reactive name.

SetDefaultActionAndTheme ( MethodDeclarationNode node ) : void

Sets the Action and Theme properties of the given MethodDeclarationNode using the default algorithms. This also sets the node's SecondaryArguments and UnknownArguments properties.

SetDefaultUnknownArguments ( MethodDeclarationNode mdn ) : void

Sets the UnknownArguments list to its default state. This includes all the formal parameters, the declaring class, and the return type (if not primitive).

StartsNounPhrase ( string word ) : bool

Determines whether the given word indicates the beginning of a noun phrase.

Приватные методы

Метод Описание
CheckForIgnorableVerb ( PhraseNode parsedName, int wordIndex ) : int

Determines whether the specified word in the given phrase is an ignorable verb. If so, it tags it appropriately.

CheckOverlap ( MethodDeclarationNode mdn, bool checkDO, bool checkIO ) : void

Checks for semantic overlaps between parts of the given method's name and its UnknownArguments. If overlaps are found, appropriate EquivalenceNodes are created.

FindFirstPreposition ( PhraseNode parsedName, int startIndex ) : int

Finds the index of the first preposition within the given PhraseNode, starting from the word indicated by startIndex.

GetNounPhrase ( PhraseNode parsedName ) : PhraseNode

Returns a PhraseNode containing the noun phrase words from the given name. All noun phrase words prior to the first preposition are included.

GetNounPhrase ( PhraseNode parsedName, int startIndex ) : PhraseNode

Returns a PhraseNode containing the noun phrase words from the given name, starting from startIndex. All noun phrase words prior to the first encountered preposition are included.

GetVerbPhrase ( PhraseNode parsedName, PhraseNode preamble ) : PhraseNode

Finds all the verbs in the given name and adds them to the given preamble.

HasOverlap ( PhraseNode name, string word ) : bool

Determines whether the given PhraseNode overlaps with the given word. The two overlap if the last word of the phrase is the same as the given word, or if the second-to-last word of the phrase is the same as the given word and the last word of the phrase is ignorable.

InitializeMembers ( ) : void

Sets the member data sets to their default states.

SetPrepositionThemeAndArguments ( MethodDeclarationNode node ) : void

Sets the Theme, SecondaryArguments and UnknownArguments properties of the given MethodDeclarationNode.

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

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

Determines whether the given node satisfies this rule. ** Note that calling this method has the effect of stripping any preamble from the given node, and tagging any digits and prepositions. **
public InClass ( ProgramElementNode node ) : bool
node ABB.Swum.Nodes.ProgramElementNode The node to test.
Результат bool

IsChecker() защищенный метод

Determines whether the given word indicates a checker method.
protected IsChecker ( string word ) : bool
word string The word to test.
Результат bool

IsEventHandler() защищенный метод

Determines whether a method is an event handler based upon its formal parameters.
protected IsEventHandler ( IEnumerable formalParameters ) : bool
formalParameters IEnumerable The formal parameters to test.
Результат bool

IsEventHandler() защищенный метод

Determines whether the given phrase indicates an event handler method.
protected IsEventHandler ( PhraseNode parsedName ) : bool
parsedName ABB.Swum.Nodes.PhraseNode The PhraseNode to test.
Результат bool

IsNonBaseVerb() защищенный метод

Determines whether the given word is a non-base verb, i.e. present/past participle or past tense.
protected IsNonBaseVerb ( string word ) : bool
word string The word to test.
Результат bool

IsSpecialCase() защищенный метод

Determines whether the given word indicates a method that needs special handling.
protected IsSpecialCase ( string word ) : bool
word string The word to test.
Результат bool

MakeClassification() защищенный абстрактный метод

Performs further rule testing beyond the InClass method. InClass tests whether the node is a MethodDeclarationNode, parses the node name, strips the preamble, tags digits and prepositions, then calls this method.
protected abstract MakeClassification ( MethodDeclarationNode node ) : bool
node ABB.Swum.Nodes.MethodDeclarationNode The MethodDeclarationNode to test.
Результат bool

ParseBaseVerbName() защищенный метод

Assigns part-of-speech tags to the words in the given MethodDeclarationNode's name, assuming that it follows a base verb pattern. This assumes that the node has already had its name split and preamble stripped.
protected ParseBaseVerbName ( MethodDeclarationNode node ) : void
node ABB.Swum.Nodes.MethodDeclarationNode The MethodDeclarationNode to tag.
Результат void

ParseReactiveName() защищенный метод

Assigns part-of-speech tags, and sets Action, Theme and Arguments for methods that have a reactive name.
protected ParseReactiveName ( MethodDeclarationNode mdn ) : void
mdn ABB.Swum.Nodes.MethodDeclarationNode The MethodDeclarationNode to parse.
Результат void

SetDefaultActionAndTheme() защищенный метод

Sets the Action and Theme properties of the given MethodDeclarationNode using the default algorithms. This also sets the node's SecondaryArguments and UnknownArguments properties.
protected SetDefaultActionAndTheme ( MethodDeclarationNode node ) : void
node ABB.Swum.Nodes.MethodDeclarationNode The MethodDeclarationNode to set the Action and Theme on.
Результат void

SetDefaultUnknownArguments() защищенный метод

Sets the UnknownArguments list to its default state. This includes all the formal parameters, the declaring class, and the return type (if not primitive).
protected SetDefaultUnknownArguments ( MethodDeclarationNode mdn ) : void
mdn ABB.Swum.Nodes.MethodDeclarationNode The MethodDeclarationNode to set UnknownArguments on.
Результат void

StartsNounPhrase() защищенный метод

Determines whether the given word indicates the beginning of a noun phrase.
protected StartsNounPhrase ( string word ) : bool
word string The word to test.
Результат bool

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

Creates a new UnigramMethodRule using default values for data sets.
public UnigramMethodRule ( ) : System
Результат System

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

Creates a new UnigramMethodRule.
public UnigramMethodRule ( HashSet specialWords, HashSet booleanArgumentVerbs, HashSet nounPhraseIndicators, PositionalFrequencies positionalFrequencies ) : System
specialWords HashSet A list of words that indicate the method name needs special handling.
booleanArgumentVerbs HashSet A list of verbs that indicate that the boolean arguments to a method should be included in the UnknownArguments list.
nounPhraseIndicators HashSet A list of word that indicate that beginning of a noun phrase.
positionalFrequencies ABB.Swum.WordData.PositionalFrequencies Positional frequency data.
Результат System

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

Creates a new UnigramMethodRule.
public UnigramMethodRule ( PartOfSpeechData posData, Tagger tagger, IdSplitter splitter ) : System
posData ABB.Swum.WordData.PartOfSpeechData The part-of-speech data to use.
tagger Tagger The part-of-speech tagger to use.
splitter IdSplitter The identifier splitter to use.
Результат System

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

Creates a new UnigramMethodRule.
public UnigramMethodRule ( PartOfSpeechData posData, Tagger tagger, IdSplitter splitter, HashSet specialWords, HashSet booleanArgumentVerbs, HashSet nounPhraseIndicators, PositionalFrequencies positionalFrequencies ) : System
posData ABB.Swum.WordData.PartOfSpeechData The part-of-speech data to use.
tagger Tagger The part-of-speech tagger to use.
splitter IdSplitter The identifier splitter to use.
specialWords HashSet A list of words that indicate the method name needs special handling.
booleanArgumentVerbs HashSet A list of verbs that indicate that the boolean arguments to a method should be included in the UnknownArguments list.
nounPhraseIndicators HashSet A list of word that indicate that beginning of a noun phrase.
positionalFrequencies ABB.Swum.WordData.PositionalFrequencies Positional frequency data.
Результат System