17.2 Creating a Sentiment Classifier Preference

Use the CTX_DDL.CREATE_PREFERENCE procedure to create a sentiment classifier preference and the CTX_DDL.SET_ATTRIBUTE procedure to define its attributes. The classifier type associated with a user-defined sentiment classifier preference is SENTIMENT_CLASSIFIER.

To create a sentiment classifier preference:

  1. To define a sentiment classifier preference, use the CTX_DDL.CREATE_PREFERENCE procedure. The classifier must be of type SENTIMENT_CLASSIFIER.
  2. To define attributes for the sentiment classifier preference, use the CTX_DDL.SET_ATTRIBUTE procedure. The attributes define the parameters that are used to train the sentiment classifier.

Example 17-1 Creating a Sentiment Classifier Preference

The following example creates a sentiment classifier preference named clsfier_camera. This preference is used to classify a set of documents that contain reviews for SLR cameras.

  1. Define a sentiment classifier preference named clsfier_camera with type SENTIMENT_CLASSIFIER.

    exec ctx_ddl.create_preference('clsfier_camera','SENTIMENT_CLASSIFIER');
  2. Define the attributes of the clsfier_camera sentiment classifier preference. Set 1000 for the maximum number of features to be extracted. Set 600 for the number of iterations for which the classifier runs.

    exec ctx_ddl.set_attribute('clsfier_camera','MAX_FEATURES','1000');
    exec ctx_ddl.set_attribute('clsfier_camera','NUM_ITERATIONS','600');

For attributes that are not explicitly defined, the default values are used.