How do I create or configure a recognizer?

When you create a new action with the Widgets and Live Text wizards, you can optionally configure new or existing recognizers within a wizard action. You can also configure and publish recognizers independently of their inclusion in a widget. Users can click on Live Text to initiate an action that has been pre-wired to act in a specific manner on that text pattern. For example, if email addresses are recognized as Live Text, you could click on a Live Text email address to open a new mail message addressed to that email recipient.

About this task

Live Text is a recognized text pattern in the active document that users can act on to initiate a wizard action. You can add a recognizer to a widget to define how the widget will act relative to that Live Text by wiring recognized data to actions. Recognizers are defined using standard Java regular expressios. Live Text appears in the active document as dash-underlined text.

Recognizers can be wired to act with content types for a specific action when you create a widget. You can also see and act on other actions, content types, and recognizers in the Widget Management view by clicking Manage Actions, Content Types, and Recognizers from the My Widgets options menu.

Procedure

  1. Click Configure Recognizer from the My Widgets options menu.
    Note: You can also create new recognizers using the Recognizers tab in the Widget Management view. As well, when you use the wizards to create widgets, you can optionally open the Configure a Recognizer dialog while configuring the new widget.
  2. Enter a recognizer name, for example US ZIP code.
  3. Choose an existing content type from the available list or create a new one by clicking New Type and entering one. For example, specify Address.

    This name appears in the Widget Management view's Content Types tab in the Display Name field and on the Recognizer tab in the Content Type Name field.

  4. Enter a regular expression, for example \b[0-9]{5}\b.

    Recognizers are created as Java regular expressions. Two sample sites are:

    java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html
    regex.powertoy.org

    You must enter a valid expression. If the value you enter is an invalid regular expression, you will receive an error.

    This entry appears in the Widget Management view's Recognizer tab in the Regex field.

  5. Enter a group number and a content property. The 0 group is always the entire matched expression. After that, the group numbers correspond to parenthesis in the regular expression. For example, setting the grouping number 0 content property value to content.uszip will map the entire matched expression to this property.

    This name appears in the Widget Management view's Recognizer tab in the Content Type ID field.

  6. Click OK.