Create a combined thesaurus from a CSV file.


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 NetricsCombinedThesaurus(
   string name,
   string filename,
   string encoding
)
C++
public:
 NetricsCombinedThesaurus(
   String name,
   String filename,
   String encoding
) sealed 
J#
public NetricsCombinedThesaurus(
   string name,
   string filename,
   string encoding
)
JScript
public function NetricsCombinedThesaurus(
   name : String,
   filename : String,
   encoding : String
)

Parameters

name
The name of the combined thesaurus to be created.
filename
The name of the file from which to read the thesaurus. This must name a file 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

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

Example

This sample code shows how to create a Combined 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);
                        // 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");
                    }
                  }
               }
               
             

See Also