|
ibi Patterns .NET API
|
This class is used to define an ibi™ Patterns - Search Combined Thesaurus. More...
Public Member Functions | |
| NetricsCombinedThesaurus (String name) | |
| Create a combined thesaurus. | |
| NetricsCombinedThesaurus (String name, String filename, String encoding) | |
| Create a combined thesaurus from a CSV file. | |
| void | addEquivalenceClass (String[] terms, double weight, double penalty) |
| Add a set of related terms with associated weight and penalty. | |
| int | addClassesFrom (NetricsFieldedReader rsrc) |
| Add a set of classes from a fielded source. | |
Public Member Functions inherited from NetricsServerInterface.NetricsBaseThesaurus | |
| void | setCharmap (String name) |
| Specifies the character map used to translate thesaurus entries. | |
| void | setExactMatchMode () |
| Select exact match mode. | |
This class is used to define an ibi™ Patterns - Search Combined Thesaurus.
A combined thesaurus combines the features of a standard NetricsThesaurus with those of a NetricsWeightedDictionary.
A combined thesaurus can be used to define both substitutions as with a standard NetricsThesaurus and weighted terms as with a NetricsWeightedDictionary. The names for NetricsThesaurus objects, NetricsWeightedDictionary objects and NetricsCombinedThesaurus objects are kept in a common pool. Thus creating a NetricsCombinedThesaurus with the same name as a NetricsThesaurus or NetricsWeightedDictionary will overwrite the other object on the server.
|
inline |
Create a combined thesaurus.
Create an empty combined thesaurus. Records must be added using the addEquivalenceClass or addClassesFrom methods.
A combined thesaurus can be used to define both substitutions as with a standard NetricsThesaurus and weighted terms as with a NetricsWeightedDictionary. The names for NetricsThesaurus objects, NetricsWeightedDictionary objects and NetricsCombinedThesaurus objects are kept in a common pool. Thus creating a NetricsCombinedThesaurus with the same name as a NetricsThesaurus or NetricsWeightedDictionary will overwrite the other object on the server.
| name | The name of the combined thesaurus to be created. |
Sample code
|
inline |
Create a combined thesaurus from a CSV file.
Create a combined thesaurus and populate it from a CSV file read by the server. Each line of the file is an equivalence class. Each comma separated field of the line is a term in the equivalence class. Do not call addEquivalenceClass or addClassesFrom when using this constructor- it will throw an exception. For a combined thesaurus there must be at least three entries for each line of the file. The first item is the weight, the second item is the substitution penalty, the remaining items are the terms for this class.
A combined thesaurus can be used to define both substitutions as with a standard NetricsThesaurus and weighted terms as with a NetricsWeightedDictionary. The names for NetricsThesaurus objects, NetricsWeightedDictionary objects and NetricsCombinedThesaurus objects are kept in a common pool. Thus creating a NetricsCombinedThesaurus with the same name as a NetricsThesaurus or NetricsWeightedDictionary will overwrite the other object on the server.
A sample Combined Thesaurus csv file consisting of 2 records follows:
1.0,0.5,Margaret,Margie,Peggy
0.2,1.0,Inc,Incorporated
This sample code shows how to create a Combined Thesaurus on the ibi™ Patterns - Search Server running on the localhost listening to port 5051.
| name | The name of the combined thesaurus to be created. |
| filename | The name of the file (on the server) from which to read the thesaurus. The file must be located inside the server's loadable-data directory. |
| encoding | This defines the character encoding used in the file. Currently supported encodings are: "UTF-8" or "LATIN1". DEFAULT: "LATIN1" |
|
inline |
Add a set of classes from a fielded source.
This adds a set of equivalence classes from a fielded record source. Each fielded record is considered one equivalence class. The first two entires must be the class weight and the class penalty (as string representations of a floating point value). Thus each equivalence class must have at least three entries.
| rsrc | A NetricsFieldedReader object that provides the equivalence classes. |
|
inline |
Add a set of related terms with associated weight and penalty.
| terms | The terms for the class. |
| weight | The weight for all terms in the class. |
| penalty | The substitution penalty for terms in this class. |