C# Class mergedServices.Lexicon

Lexicon Class which is used to act as a Triple store contains Literals and Predicates that match words in the Question it has two main functions Getpredicates , GetLiterals which returns the matching literals and predicates objects
Show file Open project: sherifkandeel/weet-it_WCF Class Usage Examples

Public Methods

Method Description
GetStemmedWords ( string question ) : List>.Dictionary

Get all possible stems for each word in the string

Lexicon ( ) : System

constructor of the Lexicon class

getLiterals ( string question, int topN = 30, int Limit = 30 ) : List

get predicates is a method in lexicon class that get all LexiconLiterals objects that match some words in the Question

getPermutations ( string questionLeft ) : List

This function returns all permutations of a string ex: father of barack obama 1st iteration: father, of, barack, obama 2nd iteration: father of, of barack, barack obama 3rd iteration: father of barack, of barack obama 4th iteration: father of barack obama

getPredicates ( string question, int topN = 20, int Limit = 30 ) : List

get predicates is a method in lexicon class that get all predicates objects that match some words in the Question

Private Methods

Method Description
addDomainAndRange ( List predicateList ) : List

takes the list of Predicates and add tothem the domain and Range data needed in two steps 1st : searching for direct Domain and ranges 2nd : searching for predicates who don't have domain and ranges and select the all predicates and objects get their types and add them to the domain and range field

scoreLiterals ( List results, int n ) : List

scorePredicates ( List results, int n ) : List

scoring predicates calculating the Distance between them and the matching words then returning the n ones who have the least distance

trimPermutations ( List m ) : List

after getting all permutations this function is to remove permutations that may take time during the Query and return no results

Method Details

GetStemmedWords() public method

Get all possible stems for each word in the string
public GetStemmedWords ( string question ) : List>.Dictionary
question string String (question) to find its words stems
return List>.Dictionary

Lexicon() public method

constructor of the Lexicon class
public Lexicon ( ) : System
return System

getLiterals() public method

get predicates is a method in lexicon class that get all LexiconLiterals objects that match some words in the Question
public getLiterals ( string question, int topN = 30, int Limit = 30 ) : List
question string question to get matched predicates of it
topN int the number of top matching results to be returned, default = 10
Limit int the limit of the number of returned results in the query, default = 20
return List

getPermutations() public method

This function returns all permutations of a string ex: father of barack obama 1st iteration: father, of, barack, obama 2nd iteration: father of, of barack, barack obama 3rd iteration: father of barack, of barack obama 4th iteration: father of barack obama
public getPermutations ( string questionLeft ) : List
questionLeft string The certain string to enter
return List

getPredicates() public method

get predicates is a method in lexicon class that get all predicates objects that match some words in the Question
public getPredicates ( string question, int topN = 20, int Limit = 30 ) : List
question string question to get matched predicates of it
topN int the number of top matching results to be returned, default = 10
Limit int the limit of the number of returned results in the query, default = 20
return List