{
  "source_file": "0930",
  "source_platform": "Dev.to",
  "author": "Priyesh Dave",
  "title_listed": "Day 8: Named Entity Recognition (NER) Fundamentals",
  "keywords": "",
  "domain": "文本处理",
  "content_type": "技术教程",
  "is_paid_flag": "否",
  "url": "https://dev.to/priyeshdave6/day-8-named-entity-recognition-ner-fundamentals-im6",
  "publish_date": "2026-09-01",
  "corpus_stage": "",
  "notes": "",
  "id": "34da2135edd5",
  "collected_at": "2026-10-02T13:50:16",
  "title": "Day 8: Named Entity Recognition (NER) Fundamentals - DEV Community",
  "body_markdown": "Previously, on Day 7:\nExplained part-of-speech (POS) tagging, its importance in NLP, different approaches to tagging, common tagsets, and typical challenges such as ambiguity and unknown words.\nWhat Is Named Entity Recognition (NER)?\nNamed Entity Recognition (NER) is a core task in Natural Language Processing (NLP). Its purpose is to find and label words or phrases in text that refer to specific \"named entities.\" A named entity is any real-world object with a distinct name. In practice, this means people, companies, locations, dates, money amounts, product names, and more.\nFor example, when you read a news article, you can immediately spot terms like “Barack Obama,” “United Nations,” or “Monday, July 10.” NER lets computers do the same thing. It marks these phrases so that downstream programs know they refer to specific, meaningful things in the real world. This is foundational for many NLP tasks; knowing \"who,\" \"where,\" and \"when\" unlocks advanced automation and insight from raw text.\nCommon Types of Named Entities\nMost NER systems look for a standard set of categories, but the specifics can change depending on the tool or domain. Here are the most common named entity types, with examples:\nPerson (PER):\nNames of individuals.\nExamples:\n“Ada Lovelace,” “Serena Williams”\nOrganization (ORG):\nNames of companies, institutions, or groups.\nExamples:\n“Google,” “United Nations,” “Harvard University”\nLocation (LOC):\nGeographic places.\nExamples:\n“Germany,” “Mount Everest,” “Nile River”\nDate/Time (DATE/TIME):\nSpecific times or dates.\nExamples:\n“July 4, 1776,” “last Friday,” “3:00 PM”\nMiscellaneous (MISC):\nOther named things, like product names or events.\nExamples:\n“iPhone 15,” “Olympic Games”\nSome systems recognize more detailed categories, such as\nMoney\n(“$100”),\nPercentages\n(“55%”), or\nProducts\n. The core idea is the same: identify and label text that names a unique, real-world object.\nHow NER Works: High-Level Process\nNER is a labeling task. The basic process is:\nTokenization:\nThe text is split into tokens. A token is usually a word or punctuation mark. (Recall tokenization from earlier lessons on preprocessing.)\nLabel Assignment:\nEach token (or sometimes a complete phrase) gets a label for its entity type—if any. For example, in the sentence “Apple launched a new product in California”:\n| Token     | Label      |\n|-----------|------------|\n| Apple     | ORG        |\n| launched  | O (None)   |\n| a         | O          |\n| new       | O          |\n| product   | O          |\n| in        | O          |\n| California| LOC        |\nThis format is similar to Part-of-Speech (POS) tagging, but instead of grammatical roles, the labels mark entity types.\nSimple Rule-Based NER\nEarly NER systems were rule-based, built from patterns or lists. Two basic techniques:\nCapitalization Heuristic:\nIn English, proper nouns are capitalized. Sequences of capitalized words can signal named entities.\nDictionary (Gazetteer) Lookup:\nLists of known entities, such as country or company names, are matched against the tokens.\nExample rule for person names:\nIf a word is capitalized and appears in a list of person names, tag it as PERSON.\nStrengths:\nFast to build for simple, well-defined situations.\nNo need for training data.\nLimitations:\nMisses new or unusual names easily.\nHandles ambiguity poorly (e.g., “Apple” as the company vs “apple” as the fruit).\nDifficult to scale for messy or diverse text.\nStatistical and Machine Learning-Based NER\nModern NER uses machine learning. Instead of hand-coding rules, we train models on labeled examples. The model learns to predict, for each token, the correct entity label.\nNER here is a\nsequence labeling\nproblem—just like POS tagging (reviewed previously). Each word in a sentence receives a tag such as:\n“B-PER” (beginning of a person name),\n“I-PER” (inside a person name),\n“O” (outside any entity).\nPopular algorithms include:\nConditional Random Fields (CRF):\nEstimates the probability of a sequence of labels, considering both individual tokens and their context.\nNeural Networks (LSTMs, Transformers):\nCan learn complex patterns from large datasets, often achieving better accuracy.\nBecause these models train on thousands or millions of sentences, they can catch subtleties that rules miss—like context or edge cases. They are also much more robust to new data and rare phrases.\nNER in Practice: Minimal Code Example\nHere’s a real NER example using\nspaCy\n, a popular Python NLP library with a built-in English model:\nimport\nspacy\n# Load the English NER model. If needed: python -m spacy download en_core_web_sm\nnlp\n=\nspacy\n.\nload\n(\n\"\nen_core_web_sm\n\"\n)\ntext\n=\n\"\nBarack Obama was born in Honolulu and served as President of the United States.\n\"\ndoc\n=\nnlp\n(\ntext\n)\nfor\nent\nin\ndoc\n.\nents\n:\nprint\n(\nent\n.\ntext\n,\nent\n.\nlabel_\n)\nEnter fullscreen mode\nExit fullscreen mode\nWhat happens here:\nspacy.load\nloads the language model with NER capability.\nPassing\ntext\nto\nnlp\nprocesses the text: tokenization, NER, and more.\nLooping over\ndoc.ents\nprints each found entity and its type.\nSample output:\nBarack Obama PERSON\nHonolulu GPE\nPresident NORP\nUnited States GPE\nEnter fullscreen mode\nExit fullscreen mode\nGPE\n(Geo-Political Entity) covers locations like countries or cities.\nNORP\nis used for nationalities, religious, or political groups.\nYou can swap in any sentence to see what entities the model detects.\nApplications and Challenges of NER\nNER in the Real World\nInformation Retrieval:\nTagging and highlighting names and events for search engines.\nAutomated Document Processing:\nOrganizing or routing documents by named entities (like the sender or mentioned subjects).\nRelationship Extraction:\nFinding meaningful links between people, organizations, or places.\nKnowledge Graphs:\nTurning free text into structured facts for databases, supporting search and analytics.\nReal-World Challenges\nAmbiguity:\nMany names have multiple meanings. “Jordan” could be a person or a country; only context reveals which.\nOverlapping Entities:\nA single phrase can represent more than one thing (for example, “New York Times” is both a place and an organization).\nLanguage Change:\nNew entities (people, brands, events) keep appearing, so models and entity lists must keep up.\nDomain-Specific Names:\nTechnical, medical, or legal text often contains entities not found in general-purpose models.\nNER is not perfect—handling ambiguity, change, and domain-specific language remains hard. But even a basic NER pipeline brings order to messy text, extracting structure that downstream software can use. The next steps in NLP will show how NER becomes more powerful when combined with context and larger language models.\nKey Takeaways\nNER labels specific real-world entities like people, organizations, and dates in text.\nTraditional NER uses rule-based methods such as capitalization and dictionary lookup.\nModern NER relies on machine learning models like CRF and neural networks for higher accuracy.\nNER is foundational for applications like information retrieval, document processing, and knowledge graphs.\nAmbiguity, new entities, and domain-specific language remain major NER challenges.\nTry It Yourself\nChoose a short news paragraph or sentence and process it using spaCy's NER tool or an online NER demo. Write down all entities detected and their types. Then, check the text yourself for any missed or misclassified entities and briefly reflect on possible reasons the NER tool struggled with those cases.\nFurther Resources\n🎥\nNamed Entity Recognition (NER): NLP Tutorial For Beginners - S1 E12\n📄\nNamed Entity Recognition | Baeldung on Computer Science\n📘\nEntityRecognizer · spaCy API Documentation\n📄\nNamed Entity Recognition: Essentials, Workings, Approaches, Challenges\nComing up on Day 9:\nText Classification with Naive Bayes and Logistic Regression",
  "metadata": {
    "title": "Day 8: Named Entity Recognition (NER) Fundamentals - DEV Community",
    "description": "Previously, on Day 7: Explained part-of-speech (POS) tagging, its importance in NLP, different... Tagged with ai, nlp, genai, 100daysofcode.",
    "keywords": "ai, nlp, genai, 100daysofcode, software, coding, development, engineering, inclusive, community",
    "author": null,
    "og:type": "article",
    "og:url": "https://dev.to/priyeshdave6/day-8-named-entity-recognition-ner-fundamentals-im6",
    "og:title": "Day 8: Named Entity Recognition (NER) Fundamentals",
    "og:description": "Previously, on Day 7: Explained part-of-speech (POS) tagging, its importance in NLP, different...",
    "og:site_name": "DEV Community",
    "og:image": "https://media2.dev.to/dynamic/image/width=1200,height=627,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsyn86u04mmsicrmbir9t.png",
    "twitter:site": "@thepracticaldev",
    "twitter:creator": "@",
    "twitter:title": "Day 8: Named Entity Recognition (NER) Fundamentals",
    "twitter:description": "Previously, on Day 7: Explained part-of-speech (POS) tagging, its importance in NLP, different...",
    "twitter:card": "summary_large_image",
    "twitter:widgets:new-embed-design": "on",
    "twitter:image:src": "https://media2.dev.to/dynamic/image/width=1200,height=627,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsyn86u04mmsicrmbir9t.png"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "file": "attachments/34da2135edd5/code/body-000.txt",
      "chars": 291,
      "language": "text"
    },
    {
      "file": "attachments/34da2135edd5/code/body-001.txt",
      "chars": 66,
      "language": "text"
    }
  ],
  "images": [],
  "audio": [],
  "videos": [
    {
      "url": "https://www.youtube.com/watch?v=2XUhKpH0p4M",
      "src": "https://www.youtube.com/watch?v=2XUhKpH0p4M",
      "status": "ok",
      "kind": "single_video",
      "local_path": "attachments/34da2135edd5/videos/repair-2XUhKpH0p4M.mp4",
      "bytes": 83605530,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "1353.921000",
      "reused": false
    }
  ],
  "links": [
    {
      "href": "https://spacy.io/",
      "label": "spaCy",
      "type": "a"
    },
    {
      "href": "https://www.youtube.com/watch?v=2XUhKpH0p4M",
      "label": "Named Entity Recognition (NER): NLP Tutorial For Beginners - S1 E12",
      "type": "a"
    },
    {
      "href": "https://www.baeldung.com/cs/ner-nlp",
      "label": "Named Entity Recognition | Baeldung on Computer Science",
      "type": "a"
    },
    {
      "href": "https://spacy.io/api/entityrecognizer",
      "label": "EntityRecognizer · spaCy API Documentation",
      "type": "a"
    },
    {
      "href": "https://blog.unitlab.ai/named-entity-recognition/",
      "label": "Named Entity Recognition: Essentials, Workings, Approaches, Challenges",
      "type": "a"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T10:48:12Z",
  "source_url": "https://dev.to/priyeshdave6/day-8-named-entity-recognition-ner-fundamentals-im6",
  "papers": [],
  "actual_video_files": [],
  "body_chars": 7793,
  "expected_body_images": 0,
  "discovery_status": "ok",
  "delivery_status": "ok",
  "missing_reason": "",
  "raw_html": "attachments/34da2135edd5/pages/source.html",
  "local_html": "attachments/34da2135edd5/pages/article.html",
  "body_base_path": "attachments/34da2135edd5/pages/",
  "body_markdown_path": "attachments/34da2135edd5/pages/article.md"
}