Next: , Previous: Training, Up: API


6.2 Testing

For testing to be done, a model file needs to be created from the training data generated. The YASMET code should be used to do this.

Once a model file is created it can be used by the NEDeco class. A decorator can be created like so:

     NEDeco deco(text,true,modelFile);

Here, text is the (unannotated) text which will be searched for named entities. The second argument is whether classification will be done. For the classifier to run, it should be set to true. modelFile is the name of the YASMET generated model file.

When constructed, the decorator finds all the named entities. The entities found can be printed to an output stream with deco.printEnts(outfile)

Alternatively, the decorator functions (which are static) can be called without creating a decorator object. For example:

     // model file
     string modelFile = "model.mdl";
     // text to recognised entites in
     string text = readfile("txt.txt");
     // resultant entity vector
     vector<NamedEntity> neVec;
     // find the entities
     NEDeco.Decorate(text,neVec,true,modelFile);
     // print the entities to cout
     NEDeco.printEnts(neVec,cout);

This code performs the same functions as creating a decorator and using the printEnts() function, but allows access to the entities directly. See the NamedEntity class specification for further details.