Connecting to the database
To instantiate the API, the path of the MySQL configuration is needed and given to the constructor of the class DatabaseThesaurusDatastructure.
This class is an implementation of the IThesaurus class which contains all methods that can be available for a full model. The DatabaseThesaurusDatastructure class returns all results wrapped in a datatype of the framework. If you prefer working with HashMaps, you might consider using the implementation DatabaseThesaurusMap which wraps the results into Strings within a HashMap.
String config = "conf_mysql_de_70M_trigram.xml" DatabaseThesaurusDatastructure dt ; dt= new DatabaseThesaurusDatastructure(config); dt.connect();
At the end of using the API the connection should be closed again using:
Functions of the API
The API has several methods to access the data. Here we will shortly describe the most important ones. A more detailed documentation of all classes can be found in the JavaDoc. Additionally, the class MySqlExamples illustrates the usage of the API and prints
results using both models.
Here is an overview of the API methods:
this function returns all similar terms to a given term. As a result a list of Order2 instances is returned. Each Order2 object contains the similar word and its similarity score. [The contextScore is not yet used]
this function returns the N top most similar terms to a given token.
this function returns all similar tokens with a similarity score above D.
This function returns the frequency of the term within the processed corpus
This function returns the frequency of the context within the processed corpus
getTermContextsCount(term, context): long
return the number of co-occurrences of term and context
getTermContextsScore(term, context): long
returns the significance score of the term and context
This function returns the significant contexts (Order1 objects) for a given term.
An Order1 object contains the context feature as well as the significant score and the frequency of the term and the context.
This function returns the top N contexts for a given term.
This function returns contexts with a significance score greater then D.
This function gets the names of the available sense computations
This function gets a list of Sense objects of the standard sense type. Each sense object contains a list of words belonging to the sense and a list of IS-A’s which label the sense
This function returns a list of Senses for a specified sense type.