Named entity recognition

Named Entity Recognition Lab

Extract people, places, organizations, dates, times, amounts and percentages from text, showing how each entity was detected.

What is this module?

Named Entity Recognition (NER) finds the spans of text that refer to specific entities and classifies them. There are two main approaches: the pattern and rule approach (Regular Expressions, Gazetteers and cue words such as «جامعة» "university" and «الدكتور» "Dr."), and the statistical approach, which learns from BIO-tagged data (such as ANERcorp for Arabic) with CRF, BiLSTM-CRF or BERT models. The first is accurate for regular patterns such as dates and amounts, and the second is better for names not known in advance.

Tool: Named entity recognition

Runs in your browser (JavaScript) — your text is not sent anywhere
Settings

How does the tool work?

  • Dates, times, amounts, percentages and numbers: regular expressions that know the Syriac, Gregorian and Hijri month names, the days of the week and common Arab currencies.
  • Known places, organizations and people: lists from the database.
  • Unknown organizations and people: a head word (university, ministry...) or a title (Dr., Mr....) followed by one or more words.
  • Names in patronymic form: “فلان بن فلان” ("X son of Y") and “فلانة بنت فلان” ("X daughter of Y").
  • On overlap, the longer span is preferred, then the more specific type.

How to read the results?

The "Method" column shows what was detected by a regular expression, a list or a cue word. Entities detected by a cue word have lower confidence because the name's boundaries are estimated.

Algorithms and methods

We always distinguish between traditional algorithms, resource-based methods and trained models. The tools on this page are traditional or lexicon-based, while trained models are explained here and run only through an external engine enabled by the site admin.

Limitations and accuracy limits

This mode does not detect a person's name without a title or patronymic form (بن/بنت) unless it is in the list. Entity boundaries based on a cue word may be too long or too short. There is no trained statistical model in the default mode.

This tool's results are educational: they show how the algorithm works step by step, and they are not presented as confirmed scientific results.

From the knowledge base

Concept

Named entity classes

The classic classes from the CoNLL-2003 task: PER (person), LOC (location), ORG (organization), MISC (miscellaneous). Other schemes add date, time, money and percentage, and the OntoNotes scheme has 18 classes.

Tjong Kim Sang & De Meulder (2003)

Frequently asked questions

What is named entity recognition (NER)?

Extracting the names of people, places and organizations, dates, numbers and amounts from text and classifying them. It is used in information extraction, search and news analysis.

What NER methods does the lab use?

Three methods shown separately: regular expressions (Regex) for dates, times, numbers, links and emails; lists (Gazetteer) for known places and organizations; and trigger words (Trigger) such as «الدكتور» ("Dr.") before a name and «جامعة» ("University") before an organization's name.

Why doesn't the lab detect every person's name?

Because it contains no trained model. It detects names only when a trigger word such as «الدكتور», «الأستاذ» or «السيد» precedes them, or when they are in the lists. Trained models such as CAMeLBERT-NER need the Python engine.

What is the difference between rule-based NER and statistical NER?

Rules are precise for fixed patterns (dates and emails) but do not generalize. Statistical (CRF) and neural (BiLSTM-CRF and BERT) NER learn from labelled examples and generalize to new names, but need training data and a model.

What is the BIO tagging scheme?

A way to represent entity boundaries: B for the beginning of an entity, I for inside the entity, and O for outside any entity. For example: جامعة/B-ORG بغداد/I-ORG تأسست/O.

What makes NER hard in Arabic?

The absence of capital letters, prefixes attached to names (وبغداد، لبغداد), many names also being adjectives or common words (كريم، أمل، سعيد), and the many spellings of foreign names.

Does the lab recognize «لبغداد» and «وبغداد»?

Yes, the common prefixes (و، ف، ب، ل، ك، ال) are stripped before matching against the lists, and the result notes that the entity was caught after separating the prefix.

What time entities does the lab detect?

Numeric dates (such as 2024/05/12), Gregorian and Syriac month names with the year, days of the week, times such as «الساعة 10:30», and expressions such as «عام 2023».

How do I evaluate an NER system?

With precision, recall and F1 at the level of the whole entity, meaning the type and the boundaries must both match. This is the common CoNLL standard.

Can new names be added to the lists?

Yes, from the admin panel under "Lexicons", with the gazetteer type, specifying the class (place, organization, person).

What is the difference between MISC and the other classes?

MISC is a class for entities that are not a person, place or organization, such as events, nationalities and the titles of works. The lab does not use it in the default rules.

Exercises and challenges

Beginner Hands-on in the lab

The three methods

Load the "A short news item" example and run each method on its own. Which entity did each method catch?

Hint

Switch between the methods in the settings.

Show solution

Patterns: the date and time. Lists: Baghdad (inside University of Baghdad, if it is in the list). Trigger words: «الدكتور أحمد الساعدي» as a person, and «جامعة بغداد» as an organization.

Beginner Computing by hand

BIO tagging

Assign BIO tags to «زار أحمد جامعة بغداد أمس».

Hint

A multi-word entity starts with B and continues with I.

Show solution

زار/O أحمد/B-PER جامعة/B-ORG بغداد/I-ORG أمس/O

Intermediate Computing by hand

Computing F1

A system extracted 8 entities, 6 of them correct, and the text contains 10 correct entities. Compute P, R and F1.

Hint

F1 = 2PR/(P+R).

Show solution

P = 6/8 = 0.75, R = 6/10 = 0.60, F1 = 2×0.75×0.60/1.35 ≈ 0.667.

Intermediate Hands-on in the lab

Attached prefixes

Write «سافرنا لبغداد وبالبصرة» and check: did the tool catch both cities?

Hint

Look for the note "after separating the prefix".

Show solution

Yes, the lam, waw and baa are stripped before matching against the list.

Advanced Conceptual question

The limits of rules

Name three cases where rule-based NER fails and a trained model would be expected to succeed.

Hint

Think of new names.

Show solution

A person's name with no title before it, a new organization not in the lists, a place name used as a person's name (such as «بغداد» as a person's name).

Advanced Research challenge

Arabic NER data

Find two Arabic NER datasets, and state the classes each covers and its licence.

Hint

ANERcorp and others.

Show solution

Examples include ANERcorp (Benajiba and colleagues) with the PER, LOC, ORG and MISC classes, and WojoodNER with more classes. Check each one's licence at its official source.

Beginner Hands-on in the lab

Patterns only

Write a text with a date, a time, an email, a link and a percentage, and run the patterns method only. Were they all caught?

Hint

Patterns need no lists.

Show solution

They should all be caught because they have fixed formats; any failure points to an unsupported format.

Related sections of the site