Skip to content

Add Context Features

You can add context features either by choosing from suggested features when there is a conflict or by defining your own. A context feature is a way to compose a new feature from existing features to detect lexical patterns or indicate the existence or lack of existence of one feature given the other. The two features that compose the context feature could be any combination of dictionary features only, context features only or a combination of a dictionary and a context.

  1. When you create a new context feature, give your feature a name and select the schema category that the feature would associate with. You can select multiple schema categories.

  2. Select the two underlying features that compose the context feature. Duet supports the following 4 options for composing two features in a context feature, which we'll demonstrate with examples relating to payment issues, where we will use the concept of "issue", the concept of "pay" and a variety of tokens in-between.
    a. Precede: the feature triggers if both underlying features (e.g. issue, pay) are present with a predefined amount of tokens in-between them. This is ideal for identifying phrases in which the order of tokens is important. Such context features will capture something like "I have an issue when trying to pay for my online order". In this example, the feature will fire on "issue", "pay", and all the tokens in between.
    b. Or: the feature triggers if either of the underlying features (e.g. "issue" or "pay") is present in the document.
    c. If: this is a conditional feature that will trigger on the first feature if the second feature is present in the document.
    d. If not: this is a conditional feature that will trigger on the first feature if the second feature is not present in the document. Please note that the underlying features of a context feature could be both dictionaries, both other context features or a combination of one dictionary and one context features. This means that context features can be composed of other context features.

  3. Once finished, press "Add New" at the bottom of the screen.

You can check your progress by looking at the quality metric with every model update. When you obtain the quality that you are looking for, you should stop teaching and move onto testing for document classifiers.

Back to top