PIXELBANKv8.2.1
Menu

Simple Entity Tagger

Given a list of known entities and their types, tag each word in a sentence with its entity type using BIO format.

Input format:

  • Line 1: Number of entity entries
  • Next n lines: "word TYPE" (e.g., "John PERSON")
  • Last line: The sentence to tag

BIO format: B-TYPE for the first word of an entity, O for non-entities. For simplicity, all entities are single words.

Output: Space-separated tags, one per word.

Example:

Input:
2
John PERSON
Google ORG
John works at Google
Output:
B-PERSON O O B-ORG
Reasoning:

Step 1: Build entity lookup john → PERSON, google → ORG

Step 2: Tag each word "John" → found as PERSON → B-PERSON "works" → not found → O "at" → not found → O "Google" → found as ORG → B-ORG

Constraints:

  • All entities are single words
  • Case-insensitive matching
  • Tags: B-TYPE or O
  • Output tags space-separated
Editor

Test Results

0/0
Run code to see test results.