|
ibi Patterns .NET API
|
Objects of this class represent a weighted dictionary, used to define terms with lesser or greater importance. More...
Public Member Functions | |
| NetricsWeightedDictionary (String name) | |
| Create an empty Weighted Dictionary. | |
| NetricsWeightedDictionary (String name, String filename, String encoding) | |
| void | addEquivalenceClass (String[] terms, double weight) |
| Add terms with associated weight. | |
| 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. | |
Objects of this class represent a weighted dictionary, used to define terms with lesser or greater importance.
A weighted dictionary is used to weight terms which should have more or less relevance than other terms. For instance, in a company names table, the term "company" might be given less weight as it is less indicative of a match (i.e. it is shared by many company names that are unrelated)."
|
inline |
Create an empty Weighted Dictionary.
A weighted dictionary is used to weight terms which should have more or less relevance than other terms. For instance, in a company names table, the term "company" might be given less weight as it is less indicative of a match (i.e. it is shared by many company names that are unrelated).
This constructor creates an empty Weighted Dictionary (one with no equivalence classes defined) with the given name. Equivalence classes must be added using the addEquivalenceClass or addClassesFrom methods.
| name | The name of the weighted dictionary to be created. |
Sample code
|
inline |
A constructor used to load a weighted dictionary from a file
In this case, dictionary equivalence classes are loaded from a CSV file read by the server. Each line will be an equivalence class and terms are comma separated. Do not call addEquivalenceClass or addClassesFrom when using this constructor - it will throw an exception. For a weighted dictionary there should be at least two items per line. The first item is the weight and the remaining items are the terms to be weighted. File should be CSV format.
A sample Weighted Dictionary csv file consisting of 3 classes follows:
0.6,Liability Limited Company,LLC,L.L.C.
0.2,Inc,Incorporated
-1.0,the
The special weight value -1.0 is used to indicate a "stop token" A stop token is treated as if it does not exist at all.
This sample code shows how to create a Weighted Dictionary in an ibi™ Patterns - Search Server.
| name | The name of the dictionary 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 entry must be the class weight (as a string representation of a floating point value). Thus each equivalence class must have at least two entries.
| rsrc | A NetricsFieldedReader object that provides the equivalence classes. |
|
inline |
Add terms with associated weight.
This adds one class of equivalent terms to the weighted dictionary.
| terms | The terms to be weighted. |
| weight | The weighting factor applied to the terms. |