| ibi Patterns .NET API

Loading...
Searching...
No Matches
Public Member Functions | List of all members
NetricsServerInterface.NetricsCombinedThesaurus Class Reference

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.

## Detailed Description

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.

See also
  NetricsThesaurus, NetricsWeightedDictionary, NetricsServerInterface.cthcreate

## Constructor & Destructor Documentation

## ◆ NetricsCombinedThesaurus() [1/2]

NetricsServerInterface.NetricsCombinedThesaurus.NetricsCombinedThesaurus | ( | String | name | ) |
| 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.

Parameters

  name | The name of the combined thesaurus to be created.

See also
  NetricsWeightedDictionary, NetricsServerInterface.cthcreate, NetricsCombinedThesaurus(String, String, String)

Sample code

## ◆ NetricsCombinedThesaurus() [2/2]

NetricsServerInterface.NetricsCombinedThesaurus.NetricsCombinedThesaurus | ( | String | name,
|  | String | filename,
|  | String | encoding
| ) |  |
| 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.

using NetricsServerInterface; <br>
class MyClass
{
private static NetricsServerInterface.NetricsServerInterface si = null; <br>
public static void Main()
{
try
{
String host = "localhost";
int port = 5051;
si = new NetricsServerInterface.NetricsServerInterface(host, port);
// Combined Thesaurus input csv file
String file = "c:\\temp\\cthnames.csv";
//Combined Thesaurus name
String thesaurus = "myCombinedThesaurus";
// Use default encoding which is LATIN1 specified by the null
NetricsCombinedThesaurus ct = new NetricsCombinedThesaurus(thesaurus, file, null);
si.cthcreate(ct);
Console.Write("Combined thesaurus created.\n");
}
catch (NetricsException e)
{
Console.Write(e.getErrorDescription() + "\n");
}
}
}
NetricsServerInterface.NetricsCombinedThesaurus
This class is used to define an ibi™ Patterns - Search Combined Thesaurus.
Definition: NetricsCombinedThesaurus.cs:28
NetricsServerInterface.NetricsException
A NetricsException is thrown whenever an error occurs.
Definition: NetricsException.cs:32
NetricsServerInterface.NetricsException.getErrorDescription
String getErrorDescription()
Get the description of the error.
Definition: NetricsException.cs:110
NetricsServerInterface.NetricsServerInterface
Base class for all interactions with the ibi™ Patterns - Search Server.
Definition: NetricsServerInterface.cs:62
NetricsServerInterface
ibi™ Patterns - Search .NET Interface Overview.
Definition: BaseObjectStats.cs:14

Parameters

  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"

## Member Function Documentation

## ◆ addClassesFrom()

int NetricsServerInterface.NetricsCombinedThesaurus.addClassesFrom | ( | NetricsFieldedReader | rsrc | ) |
| 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.

Parameters

  rsrc | A NetricsFieldedReader object that provides the equivalence classes.

Returns
  the number of classes added.

See also
  NetricsCSVReader

## ◆ addEquivalenceClass()

void NetricsServerInterface.NetricsCombinedThesaurus.addEquivalenceClass | ( | String[] | terms,
|  | double | weight,
|  | double | penalty
| ) |  |
| inline

Add a set of related terms with associated weight and penalty.

Parameters

  terms | The terms for the class.
  weight | The weight for all terms in the class.
  penalty | The substitution penalty for terms in this class.