Skip to content

Interpret tagging outcome

Introduction

The results of tagging—both by rules and script—after a text analysis are displayed in the Tagger tool window.

Note

It is necessary re-analyze a test file—or all test files—included in the module if rules or test files have changed.

This operation is performed on the current test file. It is possible to check the filename in the tool window title bar.

Tagging by rules

The Tags panel

Tags produced by rules are displayed in the Tags panel on the left of the Tagger tool window, grouped by level. This means that one or more triggered rules detected a tag that is declared with TAGS.

It is possible to expand/collapse each row—representing a level—by selecting the toggle switch in the row left side or by expanding/collapsing all the rows selecting Expand All/Collapse All on the tool window toolbar.

Consider these tags and rules:

TAGS
{
    @CODE,
    @MEDICINE
}

...

SCOPE SENTENCE
{
    TAGGER()
    {
        @CODE[PATTERN("\d{8}")] // Every eight digit number will be tagged as CODE.
    }

    TAGGER()
    {
        @MEDICINE[LEMMA("drug")] // every occurrence of lemma drug in a text will be tagged as MEDICINE 
    }
}

and the text:

Ibuprofen Hs Code is 29420012.
The use of this drug is not recommended in patients with advanced renal disease.

the rule detects tags at the same level.

Clicking the level shows all the hits highlighted in the editing area.

Clicking a single tag instance shows:

  • The specific hits highlighted in the editing area (if the text file is opened).
  • The updated Rule Details/Tag Details panels.
  • The updated rule preview panel on the right.

The Rule Details/Tag Details panels

The Rule Details/Tag Details panel is composed of two sub-panels:

  • The Rule Details sub-panel that shows the hit rule plus the label, if specified in the rule.

    Note

    Rule labels are optional. See the language reference documentation to learn how to insert rule labels in a rule.

  • The Tag Details sub-panel that displays:

    • The hit of the tag selected in the Tags panel.
    • The possible Syncon ID.
    • The starting and ending positions in the sentence of the tag hit selected in the Tags panel.

The Rules panel

This panel displays the rule code.

Tagging by script

Tags produced—or untagged—by scripting functions are also displayed in the Tags panel on the left of the Tagger tool window.

With these tags and rules:

TAGS
{
    @PART_OF_BODY,
    @PART_OF_BODY_LOCATION,
    @INJURY_TYPE
}

SCOPE SENTENCE
{
    TAGGER()
    {
        @INJURY_TYPE[LEMMA("contusion")]
    }

    TAGGER()
    {
        @INJURY_TYPE[LEMMA("bruise")]
    }
}

and with this code:

function onTagger() {
    DIS.untagToken(2, "INJURY_TYPE")
    DIS.tagToken(5, "PART_OF_BODY_LOCATION")
    DIS.tagToken(8, "PART_OF_BODY")
}

applied to this text:

Contusion and bruises on the back of the head.

You will get in the Tagger tool window:

As you can see:

  • The tokens head and back were tagged with the BODY_PART and BODY_PART_LOCATION tags thanks to the onTagger function.
  • The tokens Contusion and bruises were tagged with the INJURY_TYPE tag thanks to tagging rules.
  • The INJURY_TYPE tag associated to the token bruises has been removed thanks to the onTagger function

You can recognize a tag by script thanks to the red gear icon and the letter T before its name. Untagged tag values are recognized thanks to the letter U before their names.

To filter the available tag values generated—or untagged—by script, select or deselect:

  • Show TAGS to show or hide script-generated tag values.
  • Show UNTAG to show or hide script-untagged tag values.

Clicking a single tag instance shows:

  • The specific hits highlighted in the editing area (if the text file is opened).
  • The updated Tag Details sub-panel.
  • The updated rule preview panel on the right.

Note

The Rule Details sub-panel is empty when dealing with tags by script.

The Tag Details sub-panel displays:

  • The hit of the tag selected in the Tags panel.
  • The possible Syncon ID.
  • The starting and ending positions in the sentence of the tag hit selected in the Tags panel.

The rule preview panel on the right only states that your tag is made by script.