{
  "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-2a5f",
  "publish_date": "2026-09-01",
  "corpus_stage": "",
  "notes": "",
  "id": "a593bb366ea9",
  "collected_at": "2026-10-02T13:50:19",
  "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?\nNamed Entity Recognition (NER) is a key task in natural language processing (NLP). NER finds and labels \"named entities\" in text. A named entity is a real-world thing—such as a person, location, or organization—that has a specific name. For example, in “Alice went to Paris,” “Alice” is a person and “Paris” is a location.\nNER is different from Part-of-Speech (POS) tagging. POS tagging labels each word’s role in the sentence (like noun, verb, or adjective). NER instead asks: is this word (or group of words) a name for a real-world thing, and what kind?\nNER powers many applications. Search engines use it to find people or companies in news stories. Chatbots use it to spot product names or locations. In general, NER helps machines find the “important things with names” inside text.\nCommon entity examples include:\nPerson names (e.g., \"Elon Musk\")\nLocations (e.g., \"New York\")\nOrganizations (e.g., \"Google\")\nDates (e.g., \"April 27th\")\nMoney values (e.g., \"$100\")\nThe list can vary with the application.\nHow NER Works: From Tokens to Entities\nNER starts by splitting text into pieces called “tokens.” A token is usually a word or a punctuation mark. The NER system examines each token (and often nearby tokens) to decide if it forms part of a named entity, and if so, of what type.\nExample:\nInput:\nBarack Obama was born in Hawaii.\nTokenized: [\nBarack\n,\nObama\n,\nwas\n,\nborn\n,\nin\n,\nHawaii\n,\n.\n]\nLabeled: [\nBarack\n(begin person),\nObama\n(inside person),\nwas\n(O),\nborn\n(O),\nin\n(O),\nHawaii\n(begin location),\n.\n(O)]\nHere, \"Barack Obama\" is recognized together as a person. \"Hawaii\" is labeled as a location. “O” means that token is outside any named entity.\nNER’s challenge is to get these groupings right, using the words and their context.\nCommon Entity Types and the BIO Annotation Scheme\nMost NER systems use a standard set of entity types. The most common are:\nPERSON:\nA person, real or fictional\nORG (Organization):\nA company or group\nGPE (Geo-Political Entity):\nA country, city, or state\nLOC (Location):\nA place that is not a GPE (like rivers, mountains)\nDATE:\nA date or period of time\nMONEY:\nA monetary value\nOthers are possible, but these cover many use cases.\nTo show where each entity starts and ends in the text, NER uses an annotation scheme. The most popular is\nBIO\n:\nB (Begin):\nFirst token of an entity\nI (Inside):\nLater token of the same entity\nO (Outside):\nNot part of any entity\nFor example:\nSentence:\nSteve Jobs founded Apple in California.\nAnnotated:\nSteve (B-PERSON)\nJobs (I-PERSON)\nfounded (O)\nApple (B-ORG)\nin (O)\nCalifornia (B-GPE)\n. (O)\nBIO tags help the system mark exactly which words belong to which entities, including names that are more than one word long.\nRule-Based vs. Machine Learning NER\nNER systems generally fall into two types: rule-based or machine learning-based.\nRule-Based NER\nuses patterns, dictionaries, or manual rules. For instance, if a word is in a list of cities, mark it as a location. Regular expressions can spot certain formats (like dates or money).\nStrengths:\nGood for narrow, clear tasks. Rules are easy to understand. High precision if cases are simple.\nWeaknesses:\nCan’t handle new or unusual names. Hard to maintain and scale. Not flexible for messy real-world data.\nMachine Learning-Based NER\ntrains a model using labeled examples. The model learns the patterns that signal the start, end, and type of entities. Most modern NER systems—including spaCy and Hugging Face—use this approach.\nStrengths:\nCan handle new entities if context is similar to training examples. Handles varied text better. Adapts to real-world complexity.\nWeaknesses:\nNeeds lots of labeled data. Mistakes can be hard to understand or fix. Quality depends heavily on the training data.\nRule-based methods work if the domain is small and data is limited. For most real-world applications, machine learning is the default choice.\nMinimal NER Example with spaCy\nLet’s see NER in action using spaCy, a powerful Python NLP library.\nimport\nspacy\n# Load spaCy's English NER model (download 'en_core_web_sm' first if needed)\nnlp\n=\nspacy\n.\nload\n(\n\"\nen_core_web_sm\n\"\n)\ntext\n=\n\"\nElon Musk founded SpaceX in California in 2002.\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\nThis script:\nLoads a pre-trained English model that knows how to spot entities.\nProcesses a simple sentence.\nPrints out each detected entity and its type, producing:\nElon Musk PERSON\n  SpaceX ORG\n  California GPE\n  2002 DATE\nEnter fullscreen mode\nExit fullscreen mode\nThis is all it takes to extract named entities from text with spaCy’s out-of-the-box model.\nNER Limitations and Common Pitfalls\nNER works well much of the time, but has real limits:\nAmbiguous Names:\n\"Apple\" can mean the fruit or the company. \"Jordan\" might be a country or a person. The system has to guess from context, and can get it wrong.\nUnseen Entities:\nNew companies, rare places, or odd spellings (“SpceX” instead of “SpaceX”) might be missed.\nContext Sensitivity:\nThe same word can mean different things in different contexts. \"Jaguar\" is an animal at a zoo, but a car brand in an auto review.\nNested or Overlapping Entities:\nSometimes one name is inside another or entities overlap. Most NER systems aren't built to handle this.\nMany NER models are trained on news or “clean” text. They often perform worse on tweets, technical documents, or text with lots of slang or typos.\nKeep these limitations in mind. NER is a powerful tool, but not foolproof. Understanding what it does (and doesn’t do) helps you use it effectively in real applications.\nKey Takeaways\nNER finds and labels real-world entities like people, places, and organizations in text.\nThe BIO tagging scheme marks entity boundaries with Begin, Inside, and Outside labels.\nRule-based NER uses hand-crafted patterns; machine learning-based NER learns from labeled examples.\nspaCy allows easy extraction of named entities with just a few lines of Python code.\nNER systems have limitations with ambiguous, unseen, or context-dependent names.\nTry It Yourself\nPick a few sentences from recent news articles or Wikipedia. Run them through the provided spaCy code and list all named entities detected, along with their types. For any entities that are missed or mislabeled, note what happened and think about possible reasons (such as ambiguity or unusual spelling).\nFurther Resources\n🎥\nNamed Entity Recognition (NER): NLP Tutorial For Beginners - S1 E12\n📘\nChapter 1: Finding words, phrases, names and concepts · Advanced NLP with spaCy\n📄\nNamed Entity Recognition: Essentials, Workings, Approaches, Challenges\n📄\nNamed Entity Recognition: How NLP Identifies People, Places & Organizations\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-2a5f",
    "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%2F2ghneqde0u06ej6c09s8.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%2F2ghneqde0u06ej6c09s8.png"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "file": "attachments/a593bb366ea9/code/body-000.txt",
      "chars": 255,
      "language": "text"
    },
    {
      "file": "attachments/a593bb366ea9/code/body-001.txt",
      "chars": 61,
      "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/a593bb366ea9/videos/repair-2XUhKpH0p4M.mp4",
      "bytes": 83605530,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "1353.921000",
      "reused": true,
      "reused_from": "xinxing-zimeiti-corpus/attachments/34da2135edd5/videos/repair-2XUhKpH0p4M.mp4"
    }
  ],
  "links": [
    {
      "href": "https://www.youtube.com/watch?v=2XUhKpH0p4M",
      "label": "Named Entity Recognition (NER): NLP Tutorial For Beginners - S1 E12",
      "type": "a"
    },
    {
      "href": "https://course.spacy.io/en/chapter1/",
      "label": "Chapter 1: Finding words, phrases, names and concepts · Advanced NLP with spaCy",
      "type": "a"
    },
    {
      "href": "https://blog.unitlab.ai/named-entity-recognition/",
      "label": "Named Entity Recognition: Essentials, Workings, Approaches, Challenges",
      "type": "a"
    },
    {
      "href": "https://fondralabs.com/blog/nlp-foundations/named-entity-recognition-how-nlp-identifies-people-places-organizations.html",
      "label": "Named Entity Recognition: How NLP Identifies People, Places & Organizations",
      "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-2a5f",
  "papers": [],
  "actual_video_files": [],
  "body_chars": 6999,
  "expected_body_images": 0,
  "discovery_status": "ok",
  "delivery_status": "ok",
  "missing_reason": "",
  "raw_html": "attachments/a593bb366ea9/pages/source.html",
  "local_html": "attachments/a593bb366ea9/pages/article.html",
  "body_base_path": "attachments/a593bb366ea9/pages/",
  "body_markdown_path": "attachments/a593bb366ea9/pages/article.md"
}