A thesaurus is used to equate terms which are not typographically similar.
Namespace: NetricsServerInterface
Assembly: NetricsServerInterface (in NetricsServerInterface.dll)
Syntax
| Visual Basic (Declaration) |
|---|
| Public Sub New( _ ByVal name As String, _ ByVal filename As String, _ ByVal encoding As String _ ) |
| C# |
|---|
| public NetricsThesaurus( string name, string filename, string encoding ) |
| C++ |
|---|
| public: NetricsThesaurus( String name, String filename, String encoding ) sealed |
| J# |
|---|
| public NetricsThesaurus( string name, string filename, string encoding ) |
| JScript |
|---|
| public function NetricsThesaurus( name : String, filename : String, encoding : String ) |
Parameters
- name
- The name of the thesaurus to be created
- filename
- The name of the file from which to read the thesaurus. This file must be accessible by the server.
- encoding
- This defines the character encoding used in the file. Currently supported encodings are: "UTF-8" or "LATIN1". DEFAULT: "LATIN1"
Remarks
In this case, thesaurus 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 addEquivalence class when using this constructor - it will throw an exception.
A sample Thesaurus csv file consisting of 2 records follows:
Margaret,Margie,Peggy
Inc,Incorporated
Example
This sample code shows how to create a Thesaurus in the TIBCO Patterns Engine running on the localhost listening to port 5051.
Copy Code
| |
|---|---|
using NetricsServerInterface;
class MyClass
{
private static NetricsServerInterface.NetricsServerInterface si = null;
public static void Main()
{
try
{
String host = "localhost";
int port = 5051;
si = new NetricsServerInterface.NetricsServerInterface(host, port);
// Thesaurus input csv file
String file = "c:\\temp\\nicknames.csv";
//Combined Thesaurus name
String thesaurus = "nicknames";
// Use default encoding which is LATIN1 specified by the null
NetricsThesaurus th = new NetricsThesaurus(thesaurus, file, null);
si.thcreate(th);
Console.Write("Thesaurus created.\n");
}
catch (NetricsException e)
{
Console.Write(e.getErrorDescription() + "\n");
}
}
}
| |