ULAPI
8.0
|
ULDictionaryDataSource is the abstract parent for classes that interface with dictionary data stored somewhere like a .uld file or a database. More...
#include <uldictionarydatasource.h>
Public Types | |
enum | { HeadwordIndex, OntologyIndex, NCommonIndexIDs } |
Public Member Functions | |
virtual ULError | attach (const ULString &dataSourceIdentifier)=0 |
virtual ULError | detach ()=0 |
virtual ULError | load ()=0 |
virtual ULError | close ()=0 |
virtual ULString | getDataSourceIdentifier ()=0 |
virtual ULDataSourceVersion | getVersion ()=0 |
virtual ULError | begin (const ULLanguage &searchLanguage, uluint32 indexID, ULDictionaryIterator &iterator)=0 |
virtual ULError | end (const ULLanguage &searchLanguage, uluint32 indexID, ULDictionaryIterator &iterator)=0 |
virtual ULError | find (const ULString &s, const ULLanguage &searchLanguage, uluint32 indexID, ULDictionaryIterator &iterator)=0 |
virtual bool | operator== (const ULDictionaryDataSource &dataSource) const =0 |
virtual ULDictionaryDescriptor | getDictionaryDescriptor ()=0 |
virtual const ULLanguage & | getFirstLanguage ()=0 |
virtual const ULLanguage & | getSecondLanguage ()=0 |
virtual const ULLanguage & | getOtherLanguage (const ULLanguage &language)=0 |
virtual ULForestType | getForestType ()=0 |
virtual void | setForester (ULForester *newForester)=0 |
virtual ULForester * | getForester ()=0 |
virtual ULError | getFeatureNameList (ULList< ULString > &featureNameList)=0 |
virtual ULError | getLocalizationRuleList (const ULLanguage &language, ULList< ULLocalizationRule > &localizationRulesList)=0 |
virtual bool | getULDAttribute (const ULString &key, ULString &value)=0 |
Public Member Functions inherited from ULDictionary | |
virtual | ~ULDictionary () |
Public Member Functions inherited from ULWorker | |
ULWorker () | |
virtual | ~ULWorker () |
virtual bool | isServiceAvailable (const ULServiceDescriptor &service)=0 |
virtual void | getAvailableServices (ULList< ULServiceDescriptor > &serviceList)=0 |
virtual void | setCancelOperation (bool shouldCancel) |
virtual bool | shouldCancelOperation () const |
Public Member Functions inherited from ULDataSource | |
virtual | ~ULDataSource () |
Public Member Functions inherited from ULLockable | |
ULLockable () | |
ULLockable (const ULLockable &lockable) | |
virtual | ~ULLockable () |
const ULLockable & | operator= (const ULLockable &lockable) |
void | clear () |
ULLock * | getLock () |
void | setLock (ULLock *newLock) |
Additional Inherited Members | |
Protected Attributes inherited from ULLockable | |
ULLock * | lock |
ULDictionaryDataSource is the abstract parent for classes that interface with dictionary data stored somewhere like a .uld file or a database.
Dictionary data sources also support a mapping between feature names and feature IDs that are native to the data source in question. For example, the terms and translations in an Ultralingua dataset might have features called "usage", "dialect", "tone", etc. corresponding to integer values stored in a .uld file or database, while Collins datasets might have some of the same features as Ultralingua plus some idiosyncratic ones like "biographicalinfo". getFeatureNameList enables the dictionary data source's associated ULForester object to map names to IDs as needed.
Warning: If you find yourself thinking about directly using one of the subclasses of this class, you should reconsider. It is much easier to use ULAPI's data sources correctly by working with a ULFactory and the associated higher-level tools such as ULConjugator or ULStemmer, which take care of the initialization and manipulation of the data sources for you.
|
pure virtual |
Causes this ULDataSource object to be associated with the specified data source, and reads enough information from that data source to determine its language(s), etc.
The exact behavior of attach will be dependent on the nature of the data source. If the data source is a file, then attach will read header information from the file and then close the file to save memory until the data source is actually needed. On the other hand, if the data source is a remote database, then attach might open a connection, collect header information, and then close the connection.
[in] | dataSourceIdentifier | A string describing the data source (e.g. a file name, a database connection string, a URL, etc.). |
Implements ULDataSource.
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Creates an iterator pointing to the first ULDictionaryNode in the set of nodes associated with the specified index. An "index" in this context refers to a sorted list of strings in the data source associated with this ULDictionary object. The most common index is the "headword" index, which is an alphabetized list of labels for dictionary entries. Other indexes may support searching for dictionary entries whose definitions contain the search string, or whose "domain" labels (e.g. "Cooking", "Botany", "Computers", "Sports") match the search string, etc.
[in] | searchLanguage | For bilingual dictionaries, this indicates the language of the index in question. (For example, an English-Spanish data source would have both an English headword index and a Spanish headword index, and searchLanguage would tell begin() which of these indexes to use.) |
[in] | indexID | An enumerated value specifying which index to search. |
[out] | iterator | An iterator pointing to the first ULDictionaryNode associated with the specified index. |
Implements ULDictionary.
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Frees dynamically allocated memory associated with this data source while keeping it attached to the file, db, etc. to which it was previously attached. Also closes any relevant files, db connections, etc.
Implements ULDataSource.
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Releases the connection between this ULDataSource object and the data source specified in the previous open() or attach() call, closing any relevant files or network connections and freeing memory in the process.
Implements ULDataSource.
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Creates an iterator pointing to the end of the list of ULDictionaryNodes associated with the specified index. An "index" in this context refers to a sorted list of strings in the data source associated with this ULDictionary object. The most common index is the "headword" index, which is an alphabetized list of labels for dictionary entries. Other indexes may support searching for dictionary entries whose definitions contain the search string, or whose "domain" labels (e.g. "Cooking", "Botany", "Computers", "Sports") match the search string, etc.
[in] | searchLanguage | For bilingual dictionaries, this indicates the language of the index in question. (For example, an English-Spanish data source would have both an English headword index and a Spanish headword index, and searchLanguage would tell begin() which of these indexes to use.) |
[in] | indexID | An enumerated value specifying which index to search. |
[out] | iterator | An iterator pointing to the end of the ULDictionaryNode list associated with the specified index. |
Implements ULDictionary.
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Searches the data source(s) associated with this ULDictionary for the closest match to the specified search string, using the specified language and index. An "index" in this context refers to a sorted list of strings in the data source associated with this ULDictionary object. The most common index is the "headword" index, which is an alphabetized list of labels for dictionary entries. Other indexes may support searching for dictionary entries whose definitions contain the search string, or whose "domain" labels (e.g. "Cooking", "Botany", "Computers", "Sports") match the search string, etc.
The "closest match" found by this method is closest in the sense of a binary search on a sorted list. More specifically, the closest match is the lexicographically smallest item in the specified index that is greater than or equal to the search string. Thus, for example, if you search for "sp" in English, you'll get an iterator pointing to the first English word starting with "sp" or "Sp" (e.g. "spa").
[in] | searchString | The string you're looking for. |
[in] | searchLanguage | For bilingual dictionaries, this specifies the direction in which to search–i.e. the language in which searchString is to be interpreted. |
[in] | indexID | An enumerated value specifying which index to search. |
[out] | iterator | An iterator pointing to the closest match in the specified index. This iterator will point to a top-level ULDictionaryNode (i.e. one with no parent node). |
Implements ULDictionary.
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Implements ULDataSource.
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Obtains the list of feature names stored in this data source. The feature names in this list are associated, in the data source itself, with integer IDs starting at 0 for the first string in featureNameList, and going up to featureNameList.length() - 1.
[out] | featureNameList | the list of feature names stored in this data source. |
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Obtains the list of localization rules stored in this data source for the given language.
[in] | language | The language for which to retrieve the rules. |
[out] | localizationRuleList | The list of localization rule stored in this data source for the given language |
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Retrieves the ULD attribute value associated with the given key if it exists for this ULD.
[in] | key | The string that is the key for the attribute you want to retrieve. |
[out] | value | The value of the attribute if it exists. |
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Implements ULDataSource.
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Perform one-time opening and loading operations. Normally, such operations are performed lazily, when the data source is first queried. If you would prefer to control the time at which loading is performed, call this method.
Implements ULDataSource.
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Implemented in ULJSONDictionaryDataSource.
|
pure virtual |
Assigns the forester to be used by this ULDictionaryDataSource. The data source takes responsibility for deleting the forester.
[in] | newForester | A pointer to the desired forester. |
Implemented in ULJSONDictionaryDataSource.