PIXELBANKv8.2.1
Menu

BIO Entity Span Extractor

Given a sentence and its BIO tags, extract all entity spans with their types.

Input format:

  • Line 1: The sentence (space-separated words)
  • Line 2: Space-separated BIO tags (B-TYPE, I-TYPE, or O)

Output: Each entity on a separate line as "WORDS: TYPE". If no entities, print "No entities found".

Example:

Input:
John Smith works at New York
Output:
John Smith: PERSON
New York: LOC
Reasoning:

Step 1: Parse BIO tags John=B-PERSON, Smith=I-PERSON, works=O, at=O, New=B-LOC, York=I-LOC

Step 2: Group consecutive B+I tags Entity 1: "John Smith" → PERSON Entity 2: "New York" → LOC

Constraints:

  • B-TYPE starts a new entity
  • I-TYPE continues the previous entity
  • O means no entity
  • Output format: "WORDS: TYPE" per line
Editor

Test Results

0/0
Run code to see test results.