{
  "source_file": "0930",
  "source_platform": "Dev.to",
  "author": "Javier Aguirre",
  "title_listed": "Part of Speech Tagging: How NLP Understands Grammar",
  "keywords": "",
  "domain": "文本处理",
  "content_type": "技术教程",
  "is_paid_flag": "否",
  "url": "https://dev.to/javiagu13/part-of-speech-tagging-how-nlp-understands-grammar-2if5",
  "publish_date": "2026-09-07",
  "corpus_stage": "",
  "notes": "",
  "id": "fe1a9431d226",
  "collected_at": "2026-10-02T13:54:14",
  "title": "Part of Speech Tagging: How NLP Understands Grammar - DEV Community",
  "body_markdown": "You learned this in school, even if you’ve forgotten most of it.\nNouns are things. Verbs are actions. Adjectives describe. Adverbs modify. At some point a teacher made you underline the subject of a sentence or circle the verb, and then you moved on with your life.\nBut here’s the thing: that grammatical knowledge you picked up in school is exactly what NLP systems need to understand language. Before a model can extract meaning from text, it needs to know what role each word is playing. Is “bank” a noun or a verb? Is “fast” an adjective or an adverb? The same word can be both, depending on context.\nPart of speech tagging\nis how NLP systems figure that out. It’s one of the foundational steps in language understanding, and it quietly powers a huge number of the NLP applications you use every day.\nWhat Is Part of Speech?\nA\npart of speech\nis a grammatical category that tells you what role a word plays in a sentence.\nEvery word in a sentence belongs to at least one category. The main ones you’ll encounter in NLP are:\nNoun (NN):\na person, place, thing, or concept.\n“dog,” “London,” “happiness”\nVerb (VB):\nan action or state.\n“run,” “is,” “understand”\nAdjective (JJ):\ndescribes a noun.\n“fast,” “blue,” “complicated”\nAdverb (RB):\nmodifies a verb, adjective, or other adverb.\n“quickly,” “very,” “not”\nPronoun (PRP):\nreplaces a noun.\n“he,” “she,” “it,” “they”\nPreposition (IN):\nshows relationships between words.\n“in,” “on,” “at,” “between”\nConjunction (CC):\nconnects words or clauses.\n“and,” “but,” “or”\nDeterminer (DT):\nintroduces a noun.\n“the,” “a,” “this,” “some”\nIn NLP, these categories are assigned short codes called\nPenn Treebank tags\n, which is why you’ll often see labels like\nNN\n,\nVBZ\n, or\nJJ\nrather than full words. Different frameworks use slightly different tag sets, but the underlying categories are consistent.\nCommon part of speech tags used in NLP with their Penn Treebank codes and examples\nWhat Is Part of Speech Tagging?\nPart of speech tagging\n(also called POS tagging) is the process of automatically assigning a grammatical label to every word in a sentence.\nGiven the sentence:\n“The quick brown fox jumps over the lazy dog.”\nA POS tagger produces:\nThe/DT quick/JJ brown/JJ fox/NN jumps/VBZ over/IN the/DT lazy/JJ dog/NN\nEvery word gets its tag. The model has now turned an unstructured sentence into structured grammatical information that downstream systems can reason about.\nThis sounds straightforward, but the hard part is ambiguity. The same word can be different parts of speech depending on context, and it happens constantly in real language.\nTake the word\n“run”\n:\nA POS tagger has to resolve this ambiguity correctly, using the surrounding words as context. That’s where the actual intelligence lies.\nWhy Does POS Tagging Matter?\nOn its own, knowing that a word is a noun or a verb might seem like a small thing. But POS tags unlock a surprisingly wide range of downstream capabilities.\nNamed Entity Recognition\nrelies on POS tags to know where to look. Proper nouns (NNP) are strong signals for names of people, places, and organisations. A system that already knows which tokens are proper nouns has a massive head start on finding entities.\nDependency parsing\n(figuring out the grammatical relationships between words) depends on POS tags. You can’t determine whether a word is the subject or object of a verb without first knowing which words are verbs and which are nouns.\nWord sense disambiguation\nuses POS tags to narrow down meaning.\n“Bank”\nas a noun has different senses than\n“bank”\nas a verb. Knowing the part of speech cuts the ambiguity in half before any deeper analysis begins.\nInformation extraction\nuses POS patterns to find specific structures. A rule like “find all noun phrases followed by a verb” can extract subject-action pairs from text at scale. POS tags make those patterns possible.\nSearch and indexing\nsystems use POS tags to focus on content words (nouns, verbs, adjectives) and skip function words (the, a, in, of) that carry little meaning on their own.\nHow POS Tagging Works\nModern POS taggers use machine learning, but it helps to understand the intuition first.\nThe Rule-Based Approach\nEarly POS taggers were rule-based. Linguists wrote explicit rules:\nif a word ends in “-ing” and follows a modal verb like “will” or “can,” tag it as a verb.\nThese rules worked surprisingly well for formal text but broke down on informal language, new vocabulary, and edge cases.\nStatistical Approaches\nStatistical taggers replaced hand-written rules with probabilities learned from annotated data. Given a large corpus of text where humans have manually tagged every word, the model learns:\nhow likely is this word to be a verb? Given the previous word was a determiner, how likely is the next word to be a noun?\nHidden Markov Models (HMMs) were the dominant approach for years. They model POS tagging as a sequence problem: what’s the most likely sequence of tags given this sequence of words?\nNeural Approaches\nToday, most production POS taggers use neural networks, typically the same Transformer-based models used for other NLP tasks. These models learn rich contextual representations of each word and can resolve ambiguity that simpler models miss.\nThe key advantage is context. A neural tagger doesn’t just look at a word and its immediate neighbours. It considers the entire sentence, which is exactly what’s needed to correctly tag words like\n“run”\nor\n“fast”\nthat change meaning depending on what surrounds them.\nHow a POS tagger processes a sentence from raw text to tagged output\nSyntactic Parsing: The Next Level\nPOS tagging tells you what each word is.\nSyntactic parsing\ngoes a step further and tells you how the words relate to each other.\nIn the sentence\n“The cat chased the mouse,”\nPOS tagging tells you that\n“cat”\nis a noun and\n“chased”\nis a verb. Syntactic parsing tells you that\n“cat”\nis the subject of\n“chased”\nand\n“mouse”\nis the object.\nThere are two main types of syntactic parsing:\nDependency parsing\nmaps out the grammatical relationships between individual words. Each word gets connected to a “head” word that it depends on, with a label describing the relationship: subject, object, modifier, and so on. This produces a tree structure called a dependency tree.\nConstituency parsing\nbreaks a sentence into nested phrases: a noun phrase, a verb phrase, a prepositional phrase. Each phrase can contain smaller phrases, producing a hierarchical tree that represents the full grammatical structure of the sentence.\nBoth forms of parsing build directly on POS tags. They’re the next layer of structural understanding above tagging, and they’re used in more complex NLP tasks like question answering, machine translation, and relation extraction.\nDependency parsing and constituency parsing both build on POS tags to reveal sentence structure\nPOS Tagging in Practice with NLTK\nIf you want to try POS tagging yourself, NLTK is the easiest starting point in Python.\nimport\nnltk\nnltk\n.\ndownload\n(\n'\naveraged_perceptron_tagger\n'\n)\nnltk\n.\ndownload\n(\n'\npunkt\n'\n)\nfrom\nnltk.tokenize\nimport\nword_tokenize\nfrom\nnltk\nimport\npos_tag\nsentence\n=\n\"\nThe quick brown fox jumps over the lazy dog.\n\"\ntokens\n=\nword_tokenize\n(\nsentence\n)\ntags\n=\npos_tag\n(\ntokens\n)\nprint\n(\ntags\n)\n# [('The', 'DT'), ('quick', 'JJ'), ('brown', 'JJ'), ('fox', 'NN'),  \n#  ('jumps', 'VBZ'), ('over', 'IN'), ('the', 'DT'), ('lazy', 'JJ'), ('dog', 'NN'), ('.', '.')]\nEnter fullscreen mode\nExit fullscreen mode\nFour lines of meaningful code. Every token gets its tag.\nFor production use, spaCy is the better choice. It’s faster, more accurate, and built for real-world text:\nimport\nspacy\nnlp\n=\nspacy\n.\nload\n(\n\"\nen_core_web_sm\n\"\n)\ndoc\n=\nnlp\n(\n\"\nThe quick brown fox jumps over the lazy dog.\n\"\n)\nfor\ntoken\nin\ndoc\n:\nprint\n(\ntoken\n.\ntext\n,\ntoken\n.\npos_\n,\ntoken\n.\ntag_\n)\nEnter fullscreen mode\nExit fullscreen mode\nspaCy gives you two tag levels:\npos\nis a simplified universal tag (NOUN, VERB, ADJ), and\ntag\nis the fine-grained Penn Treebank tag (NN, VBZ, JJ). For most applications, the simplified tags are enough.\nIs POS Tagging Still Used Today?\nIt’s a fair question. With large language models able to understand language end-to-end, does anyone still bother with POS tagging?\nThe answer is yes, and more than you might expect.\nIn production NLP systems, POS tagging is rarely the star of the show. But it quietly sits inside many of the pipelines that power real applications. Here’s where it still earns its place.\nClinical and legal NLP\nrelies heavily on POS tagging. These domains often use rule-based extraction pipelines alongside machine learning, because rules are auditable and explainable in ways that a neural network isn’t. When a hospital system needs to extract medication names and dosages from clinical notes, a pipeline that uses POS tags to identify noun phrases and filter by surrounding context is fast, transparent, and reliable.\nInformation extraction at scale\nstill uses POS-based patterns extensively. If you need to extract all “company acquired company” events from a corpus of ten million news articles, a POS-aware pattern matcher is often faster and more controllable than a fine-tuned language model, especially when your compute budget is limited.\nLightweight NLP on constrained hardware\nuses POS tagging as a preprocessing step to reduce the amount of text that needs to go through expensive models. Filter out irrelevant sentences using POS patterns first, then run your heavy model only on what’s left.\nspaCy pipelines\nin production almost always include a POS tagger as a standard component. When you load a spaCy model, POS tagging happens automatically as part of the pipeline. Even if you never explicitly use the tags yourself, the downstream components like the dependency parser and named entity recogniser depend on them under the hood.\nMultilingual systems\noften lean on POS tagging more heavily than English-only ones. For languages with complex morphology or less training data available for large models, grammatical structure provides signal that pure statistical learning can miss.\nThe broader point: POS tagging is a foundational layer, not a product in itself. It doesn’t do anything impressive on its own. But remove it from a serious NLP pipeline and you’ll quickly feel the gaps it was quietly filling.\nThe best NLP systems are not built from one powerful model. They are built from layers of structured understanding, each one making the next more accurate.\nWhat Comes Next\nPOS tagging gives you the grammatical skeleton of a sentence. But grammar alone doesn’t tell you what a sentence means.\nThe next step is understanding how words relate to each other in terms of meaning, not just structure. That leads us to\nDependency Parsing\n, where we look at how NLP models map out the relationships between words: who did what to whom, what modifies what, and how the parts of a sentence connect into a coherent whole.\nLearn This at Fondra Labs\nThis post is part of our\nNLP Foundations series\n, where we build up practical AI knowledge one concept at a time, starting from the basics and going all the way to production-grade systems.\nAt\nFondra Labs\n, we teach AI from production reality, not hype. Every topic in this series is chosen because it genuinely matters when you sit down to build something real.\nIf this was useful, explore the rest of the blog. We cover everything from machine learning fundamentals to deep learning architectures, NLP pipelines, and the practical skills that turn understanding into building.\nOriginally published at\nhttps://fondralabs.com\n.",
  "metadata": {
    "title": "Part of Speech Tagging: How NLP Understands Grammar - DEV Community",
    "description": "You learned this in school, even if you’ve forgotten most of it.  Nouns are things. Verbs are... Tagged with nlp, ai, machinelearning.",
    "keywords": "nlp, ai, machinelearning, software, coding, development, engineering, inclusive, community",
    "author": null,
    "og:type": "article",
    "og:url": "https://dev.to/javiagu13/part-of-speech-tagging-how-nlp-understands-grammar-2if5",
    "og:title": "Part of Speech Tagging: How NLP Understands Grammar",
    "og:description": "You learned this in school, even if you’ve forgotten most of it.  Nouns are things. Verbs are...",
    "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%2F7g1ea8wbgt6597os2ww9.png",
    "twitter:site": "@thepracticaldev",
    "twitter:creator": "@",
    "twitter:title": "Part of Speech Tagging: How NLP Understands Grammar",
    "twitter:description": "You learned this in school, even if you’ve forgotten most of it.  Nouns are things. Verbs are...",
    "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%2F7g1ea8wbgt6597os2ww9.png"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "file": "attachments/fe1a9431d226/code/body-000.txt",
      "chars": 455,
      "language": "text"
    },
    {
      "file": "attachments/fe1a9431d226/code/body-001.txt",
      "chars": 180,
      "language": "text"
    }
  ],
  "images": [
    {
      "status": "ok",
      "url": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu8qwdq6lpausth5w3b9x.png",
      "bytes": 103270,
      "reused": true,
      "local_path": "attachments/fe1a9431d226/images/001.png",
      "src": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu8qwdq6lpausth5w3b9x.png",
      "alt": "",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4qal9irvdktwvv45j3mx.png",
      "bytes": 74850,
      "reused": true,
      "local_path": "attachments/fe1a9431d226/images/002.png",
      "src": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4qal9irvdktwvv45j3mx.png",
      "alt": "Common part of speech tags used in NLP with their Penn Treebank codes and examples",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3hra1n5yq4gcm3212fgv.png",
      "bytes": 88564,
      "reused": true,
      "local_path": "attachments/fe1a9431d226/images/003.png",
      "src": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3hra1n5yq4gcm3212fgv.png",
      "alt": "How a POS tagger processes a sentence from raw text to tagged output",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdmiqo6ro6jubrg0fnm0g.png",
      "bytes": 79038,
      "reused": true,
      "local_path": "attachments/fe1a9431d226/images/004.png",
      "src": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdmiqo6ro6jubrg0fnm0g.png",
      "alt": "Dependency parsing and constituency parsing both build on POS tags to reveal sentence structure",
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [],
  "links": [
    {
      "href": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu8qwdq6lpausth5w3b9x.png",
      "label": "",
      "type": "a"
    },
    {
      "href": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4qal9irvdktwvv45j3mx.png",
      "label": "",
      "type": "a"
    },
    {
      "href": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3hra1n5yq4gcm3212fgv.png",
      "label": "",
      "type": "a"
    },
    {
      "href": "https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdmiqo6ro6jubrg0fnm0g.png",
      "label": "",
      "type": "a"
    },
    {
      "href": "https://fondralabs.com/blogs.html",
      "label": "NLP Foundations series",
      "type": "a"
    },
    {
      "href": "https://fondralabs.com/",
      "label": "Fondra Labs",
      "type": "a"
    },
    {
      "href": "https://fondralabs.com/blog/nlp-foundations/part-of-speech-tagging-how-nlp-understands-grammar.html",
      "label": "https://fondralabs.com",
      "type": "a"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T10:48:54Z",
  "source_url": "https://dev.to/javiagu13/part-of-speech-tagging-how-nlp-understands-grammar-2if5",
  "papers": [],
  "actual_video_files": [],
  "body_chars": 11551,
  "expected_body_images": 4,
  "discovery_status": "ok",
  "delivery_status": "ok",
  "missing_reason": "",
  "raw_html": "attachments/fe1a9431d226/pages/source.html",
  "local_html": "attachments/fe1a9431d226/pages/article.html",
  "body_base_path": "attachments/fe1a9431d226/pages/",
  "body_markdown_path": "attachments/fe1a9431d226/pages/article.md"
}