How to use `initial-value` parameter of Named Entity Recognition project in Ground Truth?

0

In my NER Ground Truth labeling job, I want give human workers a head start by applying a regular expression or other NER model to the text. When the text is shown to the human worker, I want the text spans that matched the RE/model result to already be highlighted with the found entity. Then, the human can accept the result or modify it.

It looks like Ground Truth's crowd-entity-annotation template already provides a way to do this. The documentation says the template accepts an 'initial-value' attribute, which looks like exactly what I want. I have not been successful in using it though.

  • I tried adding an 'initial-value' array to the input manifest file of my project, but it didn't make a difference.

  • I found this example project using A2I that creates a custom template for displaying a model's annotations to the worker. However, when I followed this example, it only shows the model annotations in a separate textbox versus having them pre-highlighted.

  • I modified the custom UI template from that project to explicitly set initial-value to a task.input.initial-value field, but that also didn't work.

This would be a huge speed boost if I could get it to work. What is the correct way to set and display the initial values in an NER project? Is there a working example I can look at?

1 Answer
1

Hello,

I understand that you are trying to use the ‘initial-value’ parameter of Named Entity Recognition project in Ground Truth and In this context i would like to tell you that the ‘initial-value’ array which you were trying to add in the manifest file needs to be added in the HTML UI file that you have created for the human workers to label the tasks.

Below is the code that i tried replicating at my end and when i added the ‘initial-value’ array inside the <crowd-entity-annotation> script it worked.

<script src="https://assets.crowd.aws/crowd-html-elements.js"></script>

<crowd-entity-annotation
  name="crowd-entity-annotation"
  header="Highlight parts of the text below"
  labels="[{'label': 'person', 'shortDisplayName': 'per', 'fullDisplayName': 'Person'}, {'label': 'date', 'shortDisplayName': 'dat', 'fullDisplayName': 'Date'}, {'label': 'company', 'shortDisplayName': 'com', 'fullDisplayName': 'Company'}]"
  text="Amazon SageMaker Ground Truth helps you build highly accurate training datasets for machine learning quickly."
  initial-value="[
    {
        label: 'person',
        startOffset: 0,
        endOffset: 16
    }
  ]"
>
  <full-instructions header="Named entity recognition instructions">
    <ol>
      <li><strong>Read</strong> the text carefully.</li>
      <li><strong>Highlight</strong> words, phrases, or sections of the text.</li>
      <li><strong>Choose</strong> the label that best matches what you have highlighted.</li>
      <li>To <strong>change</strong> a label, choose highlighted text and select a new label.</li>
      <li>To <strong>remove</strong> a label from highlighted text, choose the X next to the abbreviated label name on the highlighted text.</li>
      <li>You can select all of a previously highlighted text, but not a portion of it.</li>
    </ol>
  </full-instructions>

  <short-instructions>
    Apply labels to words or phrases.
  </short-instructions>

    <div id="additionalQuestions" style="margin-top: 20px">
      <h3>
        What is the overall subject of this text?
      </h3>
      <crowd-radio-group>
        <crowd-radio-button name="tech" value="tech">Technology</crowd-radio-button>
        <crowd-radio-button name="politics" value="politics">Politics</crowd-radio-button>
      </crowd-radio-group>
    </div>
</crowd-entity-annotation>

<script>
  document.addEventListener('all-crowd-elements-ready', () => {
    document
      .querySelector('crowd-entity-annotation')
      .shadowRoot
      .querySelector('crowd-form')
      .form
      .appendChild(additionalQuestions);
  });
</script>

Using the above code, I was able to view the highlighted initial-value that we provided to the human workers as a head start by applying an ‘initial-value’ label so that they could either accept or modify it :

Below is the output after running the above code:

Initial-value

If you have any difficulty in verifying any of the above mentioned points or if you still run into issue, Please reach out to AWS Support[+] (Sagemaker), along with your issue/use case in details and we would be happy to assist you further. [+] Creating support cases and case management - https://docs.aws.amazon.com/awssupport/latest/user/case-management.html#creating-a-support-casehttps://docs.aws.amazon.com/awssupport/latest/user/case-management.html#creating-a-support-case

AWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions