The Browser Will Use a Cursive Font Family. Hello World the Quick Brown Fox Jumps Over the Lazy Dog

Contents

  • one Introduction
  • ii What is POS Tagging?
    • two.1 Why POS tag is used
  • 3 POS Tagging in Spacy Library
    • three.i Spacy POS Tags List
    • iii.two Spacy POS Tagging Example
  • iv Fine Grained POS Tag
    • four.ane Fine Grained POS Tag list
  • 5 Morphology
  • 6 Counting POS Tags in Spacy
    • six.1 Counting fine-grained tags
  • 7 Visualizing the POS Tags in Spacy
      • 7.0.1 Parameters
    • 7.i Visualizing POS Tags in Long Texts in Spacy

Introduction

In this article, nosotros volition take you through the tutorial for Part of Voice communication or POS Tagging in Spacy library of Python. Nosotros will first understand what is POS tagging and why it is used and finally, meet some examples of it in Spacy.

What is POS Tagging?

The Part of speech tagging or POS tagging is the process of marking a discussion in the text to a particular lexical category based on both its context and definition. In unproblematic linguistic communication, we can say that POS tagging is the procedure of identifying a give-and-take as nouns, pronouns, verbs, adjectives, etc.

Spacy Part of Speech (POS) Tagging

Why POS tag is used

Some words tin function in more than than one way when used in different circumstances. The POS Tagging here plays a crucial role to understand in what context the word is used in the sentence. POS Tagging is useful in judgement parsing, information retrieval, sentiment analysis, etc.

  • Besides Read – Tutorial on POS Tagging and Chunking in NLTK Python

POS Tagging in Spacy Library

Spacy provides a bunch of POS tags such as Substantive (noun), PUNCT (punctuation), ADJ(adjective), ADV(adverb), etc. It has a trained pipeline and statistical models which enable spaCy to make nomenclature of which tag or label a token belongs to. For example, a give-and-take following "the" in English is about likely a substantive.

Ad

Deep Learning Specialization on Coursera

Spacy POS Tags List

Every token is assigned a POS Tag in Spacy from the following list:

POS Description EXAMPLES
ADJ adjective *big, former, green, incomprehensible, starting time*
ADP adposition *in, to, during*
ADV adverb *very, tomorrow, down, where, there*
AUX auxiliary *is, has (done), volition (practice), should (exercise)*
CONJ conjunction *and, or, merely*
CCONJ analogous conjunction *and, or, but*
DET determiner *a, an, the*
INTJ interjection *psst, ouch, bravo, hello*
Noun noun *girl, cat, tree, air, dazzler*
NUM numeral *1, 2017, 1, seventy-seven, IV, MMXIV*
PART particle *'s, not,*
PRON pronoun *I, you lot, he, she, myself, themselves, somebody*
PROPN proper noun *Mary, John, London, NATO, HBO*
PUNCT punctuation *., (, ), ?*
SCONJ subordinating conjunction *if, while, that*
SYM symbol *$, %, §, ©, +, −, ×, ÷, =, :), 😝*
VERB verb *run, runs, running, eat, ate, eating*
X other *sfpksdpsxmsa*
Infinite space

Spacy POS Tagging Example

POS Tagging in Spacy library is quite easy as seen in the below case. We only instantiate a Spacy object as doc. Nosotros iterate over doc object and employ pos_ , tag_, to print the POS tag. Spacy besides lets you access the detailed caption of POS tags past using spacy.explicate() office which is also printed in the same iteration along with POS tags.

import spacy  nlp = spacy.load("en_core_web_sm") doc = nlp("Become busy living or go decorated dying.")  print(f"{'text':{8}} {'POS':{6}} {'TAG':{6}} {'Dep':{6}} {'POS explained':{20}} {'tag explained'} ") for token in doc: print(f'{token.text:{8}} {token.pos_:{vi}} {token.tag_:{6}} {token.dep_:{vi}} {spacy.explicate(token.pos_):{20}} {spacy.explicate(token.tag_)}')

[Out] :

text     POS    TAG    Dep    POS explained        tag explained  Get      AUX    VB     ROOT   auxiliary            verb, base of operations form busy     ADJ    JJ     amod   adjective            adjective living   Noun   NN     dobj   noun                 noun, singular or mass or       CCONJ  CC     cc     coordinating conjunction conjunction, coordinating get      AUX    VB     conj   auxiliary            verb, base grade busy     ADJ    JJ     acomp  adjective            adjective dying    VERB   VBG    xcomp  verb                 verb, gerund or present participle .        PUNCT  .      punct  punctuation          punctuation marking, sentence closer            

Fine Grained POS Tag

Spacy also provides a fine-grained tag that further categorizes a token in different sub-categories. For instance, when a discussion is an adjective it further categorizes it as JJR (comparative adjective), JJS (superlative adjective), or AFX (affix describing word). We can get the listing of fine grained tags in Spacy past using nlp.pipe_labels['tagger'] as shown in the below case.

In [2]

import spacy  nlp = spacy.load("en_core_web_sm") tag_lst = nlp.pipe_labels['tagger']  print(len(tag_lst)) print(tag_lst)

[Out] :

fifty ['$', "''", ',', '-LRB-', '-RRB-', '.', ':', 'ADD', 'AFX', 'CC', 'CD', 'DT', 'EX', 'FW', 'HYPH', 'IN', 'JJ', 'JJR', 'JJS', 'LS', 'MD', 'NFP', 'NN', 'NNP', 'NNPS', 'NNS', 'PDT', 'POS', 'PRP', 'PRP$', 'RB', 'RBR', 'RBS', 'RP', 'SYM', 'TO', 'UH', 'VB', 'VBD', 'VBG', 'VBN', 'VBP', 'VBZ', 'WDT', 'WP', 'WP$', 'WRB', 'Xx', '_SP', '``']

Fine Grained POS Tag list

Below is a POS tag list, their description, Fine-grained Tag, their clarification, Morphology, and some examples.

POS POS_Description Fine-grained Tag Description Morphology EXAMPLE
0 ADJ adjective AFX braze Hyph=yes The Flintstones were a **pre**-historic family.
1 ADJ describing word JJ adjective Degree=pos This is a **good** sentence.
2 ADJ adjective JJR adjective, comparative Caste=comp This is a **better** judgement.
3 ADJ adjective JJS adjective, superlative Caste=sup This is the **best** sentence.
4 ADJ adjective PDT predeterminer AdjType=pdt PronType=prn Waking up is **half** the battle.
5 ADJ adjective PRP$ pronoun, possessive PronType=prs Poss=yes **His** arm hurts.
vi ADJ describing word WDT wh-determiner PronType=int rel Information technology's blue, **which** is odd.
7 ADJ adjective WP$ wh-pronoun, possessive Poss=yes PronType=int rel We don't know **whose** it is.
eight ADP adposition IN conjunction, subordinating or preposition It arrived **in** a box.
9 ADV adverb EX existential there AdvType=ex **There** is cake.
10 ADV adverb RB adverb Degree=pos He ran **chop-chop**.
eleven ADV adverb RBR adverb, comparative Degree=comp He ran **quicker**.
12 ADV adverb RBS adverb, superlative Degree=sup He ran **fastest**.
13 ADV adverb WRB wh-adverb PronType=int rel **When** was that?
14 CONJ conjunction CC conjunction, coordinating ConjType=coor The airship popped **and** everyone jumped.
15 DET determiner DT determiner **This** is **a** sentence.
16 INTJ interjection UH interjection **Um**, I don't know.
17 NOUN noun NN substantive, singular or mass Number=sing This is a **sentence**.
18 Noun noun NNS noun, plural Number=plur These are **words**.
nineteen Noun noun WP wh-pronoun, personal PronType=int rel **Who** was that?
20 NUM numeral CD fundamental number NumType=card I want **iii** things.
21 PART particle POS possessive ending Poss=yeah Fred**'s** name is brusk.
22 Role particle RP adverb, particle Put it **back**!
23 PART particle TO infinitival to PartType=inf VerbForm=inf I want **to** go.
24 PRON pronoun PRP pronoun, personal PronType=prs **I** want **y'all** to go.
25 PROPN proper noun NNP noun, proper atypical NounType=prop Number=sign **Kilroy** was here.
26 PROPN proper noun NNPS noun, proper plural NounType=prop Number=plur The **Flintstones** were a pre-historic family.
27 PUNCT punctuation -LRB- left round bracket PunctType=brck PunctSide=ini rounded brackets **(**also called parentheses)
28 PUNCT punctuation -RRB- right round bracket PunctType=brck PunctSide=fin rounded brackets (also chosen parentheses**)**
29 PUNCT punctuation , punctuation marker, comma PunctType=comm I**,**me and myself.
30 PUNCT punctuation : punctuation mark, colon or ellipsis colon **:** is a punctuation marking
31 PUNCT punctuation . punctuation marking, sentence closer PunctType=peri Punctuation at the terminate of sentence**.**
32 PUNCT punctuation " closing quotation marker PunctType=quot PunctSide=fin "machine learning**"**
33 PUNCT punctuation "" closing quotation mark PunctType=quot PunctSide=fin **""**
34 PUNCT punctuation " opening quotation mark PunctType=quot PunctSide=ini **"**machine learning"
35 PUNCT punctuation HYPH punctuation marker, hyphen PunctType=dash ML site **-** machinelearningknowledge.ai
36 PUNCT punctuation LS list particular mark NumType=ord
37 PUNCT punctuation NFP superfluous punctuation
38 SYM symbol # symbol, number sign SymType=numbersign This is hash**#** symbol.
39 SYM symbol $ symbol, currency SymType=currency Dollar **$** is the proper name of more than 20 curre…
40 SYM symbol SYM symbol this is a symbol **$**
41 VERB verb BES auxiliary "exist" Let it **be**.
42 VERB verb HVS forms of "take" I**'ve** seen the Queen
43 VERB verb MD verb, modal auxiliary VerbType=modern This **could** work.
44 VERB verb VB verb, base form VerbForm=inf I want to **go**.
45 VERB verb VBD verb, past tense VerbForm=fin Tense=past This **was** a sentence.
46 VERB verb VBG verb, gerund or nowadays participle VerbForm=part Tense=pres Aspect=prog I am **going**.
47 VERB verb VBN verb, past participle VerbForm=part Tense=by Aspect=perf The treasure was **lost**.
48 VERB verb VBP verb, non-3rd person atypical present VerbForm=fin Tense=pres I **desire** to become.
49 VERB verb VBZ verb, 3rd person singular present VerbForm=fin Tense=pres Number=sing Person=iii He **wants** to get.
50 X other Add electronic mail [email protected]
51 X other FW strange word Foreign=yes Hello in spanish is **Hola**
52 10 other GW additional give-and-take in multi-discussion expression
53 X other Xx unknown
54 Infinite space _SP space
55 NIL missing tag

beaudointhense.blogspot.com

Source: https://machinelearningknowledge.ai/tutorial-on-spacy-part-of-speech-pos-tagging/

0 Response to "The Browser Will Use a Cursive Font Family. Hello World the Quick Brown Fox Jumps Over the Lazy Dog"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel