liveBook · Manning

Part-of-speech vector

As explained in Natural Language Processing in Action, Second Edition

A part-of-speech vector is a numerical representation whose coordinates indicate grammatical categories assigned to a word.

A part-of-speech vector encodes a word’s grammatical role as numerical coordinates. In a compact example, four one-hot coordinates represent ADV, ADJ, VERB, and NOUN, so each token becomes a small feature vector. section 7.2.6

The representation supports pattern detection by a one-dimensional convolution:

  • Arrange POS categories as channels and words as sequence positions. section 7.2.6

Detecting a grammatical pattern

For the phrase “rightly timed pause,” the POS vectors mark “rightly” as ADV, “timed” as VERB, and “pause” as NOUN. A three-position Conv1d kernel produces a high response where that sequence occurs.

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains one-hot encoding, channel layout, tensor conversion, kernel construction, and convolution output.
Examples
Demonstrates ADV, ADJ, VERB, and NOUN features on a quote containing the sequence “rightly timed pause.”
What it assumes
Assumes POS-tagged tokens and basic pandas, NumPy, and PyTorch operations.
What you can do after
Apply it via PyTorch by constructing POS tensors and configuring a Conv1d filter for a target grammatical sequence.
How it connects
Connects POS tagging with word embeddings, convolutional neural networks, PyTorch tensors, and Conv1d kernels.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.