How to extract multiple uima annotations of the same type with Content Analytics Studio

229 views Asked by At

I am looking for a way in Watson Explorer Content Analytics Studio to generate multiple annotations of the same type if the text contains multiple terms in one sentence or paragraph. I don't get past the one annotation, I can make it select all "text containers" but than still it produces one annotation. I tried "fire all rules at this level" but that also does not give the desired result

Below some samples

Homework will be chapters 1,2 and 4 of the book "bonjour France"

Revisit paragraphs 2 and 3 of chapter 2 in the book Big History

The content of chapter 1 to 3 will be part of the test

For next week the homework is to read pages 1,2 and 5 of the textbook

What I have so far is the following helpers (see screenshot)

enter image description here

The expected result for the first line is 3 annotations of type SinglePieceOfContent with values/features:

  1. chapter 1 book "bonjour France"
  2. chapter 2 book "bonjour France"
  3. chapter 4 book "bonjour France"

I would like to avoid building a custom annotator, but if that is the way to go I would like to see that confirmed.

1

There are 1 answers

2
mnsuk On

Two ways to do this, both are a bit clunky and may not work with your spevific data.

The first way is you can create multiple annotations with a single selection rule. So the brute force way to do this is to have a selector that looks something like this (high level, ignoring intervening tokens). First pick a maximum number of annotation your're going to do in a single sentence, say 5, then:

Selection:
find   chapter chapter? chapter? chapter? chapter? book
rule   create 5 annotations, each with limited span over just the N they refer to and add book covered text as a feature to each. 

The second way is to use updates. Create an annotation that identifies each of the chapters and include a string feature book that is set to "default". Create another annotation that identifies book. Then create an aggregate rule like this:

selection:   chapter*  book
rule:    here just drag the value of book to update the feature value currently set to default. 

No rule is actually created, it's an update. Updates can handle multiple annotations at once.