

{"id":25188,"date":"2018-08-20T04:17:46","date_gmt":"2018-08-20T04:17:46","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=25188"},"modified":"2026-04-29T11:37:20","modified_gmt":"2026-04-29T06:07:20","slug":"nltk-python-tutorial","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/","title":{"rendered":"NLTK(Natural Language Toolkit) Python Tutorial"},"content":{"rendered":"<p><span style=\"font-weight: 400\">In our last session, we discussed the<strong> NLP Tutorial<\/strong>. Today, in this NLTK <strong>Python<\/strong> Tutorial, we will learn to perform Natural Language Processing with NLTK. We will perform tasks like NLTK tokenize, removing stop words, stemming NLTK, lemmatization NLTK, finding synonyms and antonyms, and more.<\/span><\/p>\n<p>So, let&#8217;s start the NLTK Python Tutorial.<\/p>\n<h3>What is NLTK?<\/h3>\n<p>The Natural Language Toolkit (NLTK) is a Python library used in NLP projects. It is one of the oldest and most used libraries for text processing. NLTK has everything you need to work with human language \u2013 like breaking text into words, tagging parts of speech, and understanding sentence structure. It helps make machines understand human communication.<\/p>\n<p><span style=\"font-weight: 400\">First getting to see the light in 2001, NLTK hopes to support research and teaching in NLP and other areas closely related. These include <strong>Artificial Intelligence<\/strong>, empirical linguistics, cognitive science, information retrieval, and <strong>Machine Learning<\/strong>.<\/span><\/p>\n<h3>How to Install NLTK?<\/h3>\n<p><span style=\"font-weight: 400\">To install NLTK, you can use Python pip-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">pip install nltk<\/pre>\n<p>Then, to import it, you can type in the interpreter-<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; import nltk<\/pre>\n<p>Finally, to install packages from NLTK, you need to use its downloader. Try this-<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; nltk.download()<\/pre>\n<div id=\"attachment_25200\" style=\"width: 602px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/downloader-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-25200\" class=\"wp-image-25200 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/downloader-1.png\" alt=\"NLTK Python Tutorial\" width=\"592\" height=\"493\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/downloader-1.png 592w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/downloader-1-150x125.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/downloader-1-300x250.png 300w\" sizes=\"auto, (max-width: 592px) 100vw, 592px\" \/><\/a><p id=\"caption-attachment-25200\" class=\"wp-caption-text\">NLTK Python Tutorial &#8211; How to Install NLTK?<\/p><\/div>\n<p><span style=\"font-weight: 400\">You can download all packages or choose the ones you wish to download. Explore the \u2018All Packages\u2019 tab.<\/span><\/p>\n<h3>Tokenize Text using NLTK in Python<\/h3>\n<p><span style=\"font-weight: 400\">Before processing the text in the NLTK Python, you should tokenize it. What we mean is you should split it into smaller parts- paragraphs to sentences, sentences to words. We have two kinds of tokenizers- for sentences and for words.<\/span><\/p>\n<h4>a. NLTK Sentence Tokenizer<\/h4>\n<p><span style=\"font-weight: 400\">Let\u2019s try tokenizing a sentence.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; text=\"Today is a great day. It is even better than yesterday. And yesterday was the best day ever.\"\r\n&gt;&gt;&gt; from nltk.tokenize import sent_tokenize\r\n&gt;&gt;&gt; sent_tokenize(text)<\/pre>\n<p><strong>[&#8216;Today is a great day.&#8217;, &#8216;It is even better than yesterday.&#8217;, &#8216;And yesterday was the best day ever.&#8217;]<\/strong><br \/>\n<span style=\"font-weight: 400\">Let\u2019s try another? We\u2019ll use an exchange of dialogue this time.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; sent_tokenize(\"Hi, how are you? I'm good, you? Great!\")<\/pre>\n<p><strong>[&#8216;Hi, how are you?&#8217;, &#8220;I&#8217;m good, you?&#8221;, &#8216;Great!&#8217;]<\/strong><br \/>\n<span style=\"font-weight: 400\">Okay, one more in the NLTK Python Tutorial. How about we use words like Mrs. and Martinez\u2019s in the text? Will the tokenizer be able to catch it?<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; nltk.sent_tokenize(\"Last night, I went to Mrs. Martinez's housewarming. It was a disaster.\")<\/pre>\n<p><strong>[&#8220;Last night, I went to Mrs. Martinez&#8217;s housewarming.&#8221;, &#8216;It was a disaster.&#8217;]<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Tokenizing for a language other than English-<\/span><\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; sent_tokenize(\"Enchant\u00e9, comment allez-vous? Tres bien. Mersi, et vous?\",\"french\")<\/pre>\n<p><strong>[&#8216;Enchant\u00e9, comment allez-vous?&#8217;, &#8216;Tres bien.&#8217;, &#8216;Mersi, et vous?&#8217;]<\/strong><\/p>\n<ul>\n<li>Issues while tokenizing-<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">One issue we face while tokenizing is abbreviations-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; sent_tokenize(\"She holds an MDS. in Oral Pathology\")<\/pre>\n<p><strong>[&#8216;She holds an MDS.&#8217;, &#8216;in Oral Pathology&#8217;]<\/strong><br \/>\n<span style=\"font-weight: 400\">Whoops! That was supposed to be one complete sentence it split into two.<\/span><\/p>\n<h4>b. NLTK Word Tokenizer<\/h4>\n<p><span style=\"font-weight: 400\">First, let\u2019s tokenize <\/span><i><span style=\"font-weight: 400\">text i<\/span><\/i><span style=\"font-weight: 400\">n<\/span><i> <\/i><span style=\"font-weight: 400\">NLTK Python Tutorial<\/span><span style=\"font-weight: 400\">.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; nltk.word_tokenize(text)<\/pre>\n<p><strong>[&#8216;Today&#8217;, &#8216;is&#8217;, &#8216;a&#8217;, &#8216;great&#8217;, &#8216;day&#8217;, &#8216;.&#8217;, &#8216;It&#8217;, &#8216;is&#8217;, &#8216;even&#8217;, &#8216;better&#8217;, &#8216;than&#8217;, &#8216;yesterday&#8217;, &#8216;.&#8217;, &#8216;And&#8217;, &#8216;yesterday&#8217;, &#8216;was&#8217;, &#8216;the&#8217;, &#8216;best&#8217;, &#8216;day&#8217;, &#8216;ever&#8217;, &#8216;.&#8217;]<\/strong><br \/>\n<span style=\"font-weight: 400\">Now, let\u2019s try it for Mrs. Martinez\u2019s housewarming.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; nltk.word_tokenize(\"Last night, I went to Mrs. Martinez's housewarming. It was a disaster.\")<\/pre>\n<p><strong>[&#8216;Last&#8217;, &#8216;night&#8217;, &#8216;,&#8217;, &#8216;I&#8217;, &#8216;went&#8217;, &#8216;to&#8217;, &#8216;Mrs.&#8217;, &#8216;Martinez&#8217;, &#8220;&#8216;s&#8221;, &#8216;housewarming&#8217;, &#8216;.&#8217;, &#8216;It&#8217;, &#8216;was&#8217;, &#8216;a&#8217;, &#8216;disaster&#8217;, &#8216;.&#8217;]<\/strong><br \/>\n<span style=\"font-weight: 400\">Notice how it judged Mrs. to be one word but Martinez\u2019s to be two? NLTK uses PunktSentenceTokenizer for this.<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-charts\/\">Have a look at Python Charts<\/a><\/strong><\/p>\n<h3>Find Synonyms From NLTK WordNet<\/h3>\n<p><span style=\"font-weight: 400\"><em>WordNet<\/em> is an NLP database with synonyms, antonyms, and brief definitions. We downloaded this with the NLTK downloader.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from nltk.corpus import wordnet\r\n&gt;&gt;&gt; syn=wordnet.synsets('love')\r\n&gt;&gt;&gt; syn<\/pre>\n<p><strong>[Synset(&#8216;love.n.01&#8217;), Synset(&#8216;love.n.02&#8217;), Synset(&#8216;beloved.n.01&#8217;), Synset(&#8216;love.n.04&#8217;), Synset(&#8216;love.n.05&#8217;), Synset(&#8216;sexual_love.n.02&#8217;), Synset(&#8216;love.v.01&#8217;), Synset(&#8216;love.v.02&#8217;), Synset(&#8216;love.v.03&#8217;), Synset(&#8216;sleep_together.v.01&#8217;)]<\/strong><br \/>\n<span style=\"font-weight: 400\">Let\u2019s choose the first member from this-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; syn[0].definition()<\/pre>\n<p><strong>&#8216;a strong positive emotion of regard and affection.&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; syn[0].examples()<\/pre>\n<p><strong>[&#8216;his love for his work&#8217;, &#8216;children need a lot of love&#8217;]<\/strong><br \/>\n<span style=\"font-weight: 400\">But love isn\u2019t the only thing we\u2019re chasing after. Do you know the meaning of life? 42?<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; syn=wordnet.synsets('life')\r\n&gt;&gt;&gt; syn[0].definition()<\/pre>\n<p><strong>&#8216;a characteristic state or mode of living&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; syn[0].examples()<\/pre>\n<p><strong>[&#8216;social life&#8217;, &#8216;city life&#8217;, &#8216;real life&#8217;]<\/strong><br \/>\n<span style=\"font-weight: 400\">Nope, still doesn\u2019t answer our questions. But Python does a good job. Okay, one more example.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; syn=wordnet.synsets('AI')\r\n&gt;&gt;&gt; syn<\/pre>\n<p><strong>[Synset(&#8216;army_intelligence.n.01&#8217;), Synset(&#8216;artificial_intelligence.n.01&#8217;), Synset(&#8216;three-toed_sloth.n.01&#8217;), Synset(&#8216;artificial_insemination.n.01&#8217;)]<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; syn[1].definition()<\/pre>\n<p><strong>&#8216;the branch of computer science that deals with writing computer programs that can solve problems creatively&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; syn[1].examples()<\/pre>\n<p><strong>[&#8216;workers in AI hope to imitate or duplicate intelligence in computers and robots&#8217;]<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">To get the list of synonyms:<\/span><\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; synonyms=[]\r\n&gt;&gt;&gt; for syn in wordnet.synsets('AI'):\r\n        for lemma in syn.lemmas():\r\n               synonyms.append(lemma.name())\r\n&gt;&gt;&gt; synonyms<\/pre>\n<p><strong>[&#8216;Army_Intelligence&#8217;, &#8216;AI&#8217;, &#8216;artificial_intelligence&#8217;, &#8216;AI&#8217;, &#8216;three-toed_sloth&#8217;, &#8216;ai&#8217;, &#8216;Bradypus_tridactylus&#8217;, &#8216;artificial_insemination&#8217;, &#8216;AI&#8217;]<\/strong><\/p>\n<h3>Find Antonyms From NLTK Python WordNet<\/h3>\n<p><span style=\"font-weight: 400\">To get the list of antonyms, we first need to check the lemmas- are there antonyms?<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from nltk.corpus import wordnet\r\n&gt;&gt;&gt; antonyms=[]\r\n&gt;&gt;&gt; for syn in wordnet.synsets('depressed'):\r\n        for l in syn.lemmas():\r\n                 if l.antonyms():\r\n                          antonyms.append(l.antonyms()[0].name())\r\n&gt;&gt;&gt; antonyms<\/pre>\n<p><strong><span style=\"font-family: Verdana, Geneva, sans-serif\">[&#8216;elate&#8217;]<\/span><\/strong><br \/>\n<span style=\"font-weight: 400\">One more?<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; for syn in wordnet.synsets('ugly'):\r\n        for l in syn.lemmas():\r\n                  if l.antonyms():\r\n                            antonyms.append(l.antonyms()[0].name())\r\n&gt;&gt;&gt; antonyms<\/pre>\n<p><strong><span style=\"font-family: Verdana, Geneva, sans-serif\">[<\/span><\/strong>&#8216;<strong>beautiful<span style=\"font-family: Verdana, Geneva, sans-serif\">&#8216;]<\/span><\/strong><\/p>\n<h3>Stemming with NLTK Python<\/h3>\n<p><span style=\"font-weight: 400\">We have talked of stemming before this. Check <\/span><strong>Stemming and Lemmatization with Python<\/strong><span style=\"font-weight: 400\">. Well, stemming involves removing affixes from words and returning the root. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Search engines like Google use this to efficiently index pages. The most common algorithm for stemming is the PorterStemmer. Let\u2019s take an example.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; stemmer.stem('loving')<\/pre>\n<p><strong>&#8216;love&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; stemmer.stem('trainee')<\/pre>\n<p><strong>&#8216;traine&#8217;<\/strong><br \/>\n<span style=\"font-weight: 400\">By now, you have figured out that we don\u2019t settle for just one example. So here\u2019s more.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; stemmer.stem('syllabi')<\/pre>\n<p><strong>&#8216;syllabi&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; stemmer.stem('alibi')<\/pre>\n<p><strong>&#8216;alibi&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; stemmer.stem('formulae')<\/pre>\n<p><strong><span style=\"font-family: Verdana, Geneva, sans-serif\">&#8216;formula&#8217;<\/span><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; stemmer.stem('criteria')<\/pre>\n<p><strong>&#8216;criteria&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; stemmer.stem('believes')<\/pre>\n<p><strong><span style=\"font-family: Verdana, Geneva, sans-serif\">&#8216;believ&#8217;<\/span><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; stemmer.stem('writes')<\/pre>\n<p><strong>&#8216;write&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; stemmer.stem('writing')<\/pre>\n<p><strong>&#8216;write&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; stemmer.stem('write')<\/pre>\n<p><strong>&#8216;write&#8217;<\/strong><\/p>\n<div id=\"attachment_25198\" style=\"width: 569px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/stemming.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-25198\" class=\"wp-image-25198 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/stemming.png\" alt=\"NLTK Python Tutorial\" width=\"559\" height=\"283\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/stemming.png 559w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/stemming-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/stemming-300x152.png 300w\" sizes=\"auto, (max-width: 559px) 100vw, 559px\" \/><\/a><p id=\"caption-attachment-25198\" class=\"wp-caption-text\">NLTK Python Tutorial &#8211; Stemming<\/p><\/div>\n<p><span style=\"font-weight: 400\">Other algorithms include Lancaster and Snowball.<\/span><\/p>\n<h4>a. Stemming Words from Other Languages<\/h4>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from nltk.stem import SnowballStemmer\r\n&gt;&gt;&gt; SnowballStemmer.languages<\/pre>\n<p><strong>(&#8216;arabic&#8217;, &#8216;danish&#8217;, &#8216;dutch&#8217;, &#8216;english&#8217;, &#8216;finnish&#8217;, &#8216;french&#8217;, &#8216;german&#8217;, &#8216;hungarian&#8217;, &#8216;italian&#8217;, &#8216;norwegian&#8217;, &#8216;porter&#8217;, &#8216;portuguese&#8217;, &#8216;romanian&#8217;, &#8216;russian&#8217;, &#8216;spanish&#8217;, &#8216;swedish&#8217;)<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; rom_stemmer=SnowballStemmer('romanian')\r\n&gt;&gt;&gt; rom_stemmer.stem('englezeasc\u0103') #English<\/pre>\n<p><strong>&#8216;englez&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; rom_stemmer.stem('coco\u0219') #Cocks<\/pre>\n<p><strong><span style=\"font-family: Verdana, Geneva, sans-serif\">&#8216;coco\u0219&#8217;<\/span><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; rom_stemmer.stem('frigidere') #Refrigerators<\/pre>\n<p><strong>&#8216;frigid&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; rom_stemmer.stem('frigider') #Refrigerator<\/pre>\n<p><strong>&#8216;frigider&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; rom_stemmer.stem('goi') #Empty- plural<\/pre>\n<p><strong>&#8216;goi&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; rom_stemmer.stem('goale') #Empty- plural<\/pre>\n<p><strong>&#8216;goal&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; rom_stemmer.stem('frumoas\u0103') #Beautiful- female<\/pre>\n<p><strong><span style=\"font-family: Verdana, Geneva, sans-serif\">&#8216;frumoas&#8217;<\/span><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; rom_stemmer.stem('frumoase') #Beautiful- plural<\/pre>\n<p><strong>&#8216;frumoas&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; rom_stemmer.stem('frumo\u0219i') #Beautiful- plural<\/pre>\n<p><strong>&#8216;frumo\u0219&#8217;<\/strong><br \/>\n<span style=\"font-weight: 400\">Psst., please let us know if you catch an incorrect depiction of the language Romanian!<\/span><\/p>\n<h3>Lemmatizing NLTK Python Using WordNet<\/h3>\n<p><span style=\"font-weight: 400\">If you noticed, some words that stemmed from gave us weren\u2019t actual words you could look up in the dictionary. So we come to lemmatizing- this will return real words. Let\u2019s do this, too.<\/span><\/p>\n<p><strong>Use of NLTK Python Lemmatizing Using WordNet:<\/strong><\/p>\n<ul>\n<li>It improves accuracy by treating similar words the same<\/li>\n<li>It makes a smaller database easier to handle and process large amounts of data for analysis.<\/li>\n<li>This improves the performance of NLP by making the text more consistent.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from nltk.stem import WordNetLemmatizer\r\n&gt;&gt;&gt; lemmatizer=WordNetLemmatizer()\r\n&gt;&gt;&gt; lemmatizer.lemmatize('believes')<\/pre>\n<p><strong>&#8216;belief&#8217;<\/strong><br \/>\n<span style=\"font-weight: 400\">Stemming gave us \u2018believ\u2019 for this; lemmatizing gave us \u2018belief\u2019. See the clear difference? Where stemming returned \u2018thi\u2019, see what the lemmatizer gives us:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; lemmatizer.lemmatize('this')<\/pre>\n<p><strong>&#8216;this&#8217;<\/strong><br \/>\n<span style=\"font-weight: 400\">With \u2018believes\u2019, to work with a verb instead of a noun, use the \u2018pos\u2019 argument-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; lemmatizer.lemmatize('believes',pos='v')<\/pre>\n<p><strong>&#8216;believe&#8217;<\/strong><br \/>\n<span style=\"font-weight: 400\">And now, how about some adjectives?<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; lemmatizer.lemmatize('crossing',pos='a') #adjective<\/pre>\n<p><strong>&#8216;crossing&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; lemmatizer.lemmatize('crossing',pos='v') #verb<\/pre>\n<p><strong>&#8216;cross&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; lemmatizer.lemmatize('crossing',pos='n') #noun<\/pre>\n<p><strong>&#8216;crossing&#8217;<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; lemmatizer.lemmatize('crossing',pos='r') #adverb<\/pre>\n<p><strong><span style=\"font-family: Verdana, Geneva, sans-serif\">&#8216;crossing&#8217;<\/span><\/strong><br \/>\n<span style=\"font-weight: 400\">Since lemmatizing gives us better results within context, it is often slower than stemming.<\/span><\/p>\n<h3>NLTK Python Stop Words<\/h3>\n<p><span style=\"font-weight: 400\">We can filter the NLTK stop words from the text before processing it.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from nltk.corpus import stopwords\r\n&gt;&gt;&gt; stopwords.words('english')<\/pre>\n<p><strong>[&#8216;i&#8217;, &#8216;me&#8217;, &#8216;my&#8217;, &#8216;myself&#8217;, &#8216;we&#8217;, &#8216;our&#8217;, &#8216;ours&#8217;, &#8216;ourselves&#8217;, &#8216;you&#8217;, &#8220;you&#8217;re&#8221;, &#8220;you&#8217;ve&#8221;, &#8220;you&#8217;ll&#8221;, &#8220;you&#8217;d&#8221;, &#8216;your&#8217;, &#8216;yours&#8217;, &#8216;yourself&#8217;, &#8216;yourselves&#8217;, &#8216;he&#8217;, &#8216;him&#8217;, &#8216;his&#8217;, &#8216;himself&#8217;, &#8216;she&#8217;, &#8220;she&#8217;s&#8221;, &#8216;her&#8217;, &#8216;hers&#8217;, &#8216;herself&#8217;, &#8216;it&#8217;, &#8220;it&#8217;s&#8221;, &#8216;its&#8217;, &#8216;itself&#8217;, &#8216;they&#8217;, &#8216;them&#8217;, &#8216;their&#8217;, &#8216;theirs&#8217;, &#8216;themselves&#8217;, &#8216;what&#8217;, &#8216;which&#8217;, &#8216;who&#8217;, &#8216;whom&#8217;, &#8216;this&#8217;, &#8216;that&#8217;, &#8220;that&#8217;ll&#8221;, &#8216;these&#8217;, &#8216;those&#8217;, &#8216;am&#8217;, &#8216;is&#8217;, &#8216;are&#8217;, &#8216;was&#8217;, &#8216;were&#8217;, &#8216;be&#8217;, &#8216;been&#8217;, &#8216;being&#8217;, &#8216;have&#8217;, &#8216;has&#8217;, &#8216;had&#8217;, &#8216;having&#8217;, &#8216;do&#8217;, &#8216;does&#8217;, &#8216;did&#8217;, &#8216;doing&#8217;, &#8216;a&#8217;, &#8216;an&#8217;, &#8216;the&#8217;, &#8216;and&#8217;, &#8216;but&#8217;, &#8216;if&#8217;, &#8216;or&#8217;, &#8216;because&#8217;, &#8216;as&#8217;, &#8216;until&#8217;, &#8216;while&#8217;, &#8216;of&#8217;, &#8216;at&#8217;, &#8216;by&#8217;, &#8216;for&#8217;, &#8216;with&#8217;, &#8216;about&#8217;, &#8216;against&#8217;, &#8216;between&#8217;, &#8216;into&#8217;, &#8216;through&#8217;, &#8216;during&#8217;, &#8216;before&#8217;, &#8216;after&#8217;, &#8216;above&#8217;, &#8216;below&#8217;, &#8216;to&#8217;, &#8216;from&#8217;, &#8216;up&#8217;, &#8216;down&#8217;, &#8216;in&#8217;, &#8216;out&#8217;, &#8216;on&#8217;, &#8216;off&#8217;, &#8216;over&#8217;, &#8216;under&#8217;, &#8216;again&#8217;, &#8216;further&#8217;, &#8216;then&#8217;, &#8216;once&#8217;, &#8216;here&#8217;, &#8216;there&#8217;, &#8216;when&#8217;, &#8216;where&#8217;, &#8216;why&#8217;, &#8216;how&#8217;, &#8216;all&#8217;, &#8216;any&#8217;, &#8216;both&#8217;, &#8216;each&#8217;, &#8216;few&#8217;, &#8216;more&#8217;, &#8216;most&#8217;, &#8216;other&#8217;, &#8216;some&#8217;, &#8216;such&#8217;, &#8216;no&#8217;, &#8216;nor&#8217;, &#8216;not&#8217;, &#8216;only&#8217;, &#8216;own&#8217;, &#8216;same&#8217;, &#8216;so&#8217;, &#8216;than&#8217;, &#8216;too&#8217;, &#8216;very&#8217;, &#8216;s&#8217;, &#8216;t&#8217;, &#8216;can&#8217;, &#8216;will&#8217;, &#8216;just&#8217;, &#8216;don&#8217;, &#8220;don&#8217;t&#8221;, &#8216;should&#8217;, &#8220;should&#8217;ve&#8221;, &#8216;now&#8217;, &#8216;d&#8217;, &#8216;ll&#8217;, &#8216;m&#8217;, &#8216;o&#8217;, &#8216;re&#8217;, &#8216;ve&#8217;, &#8216;y&#8217;, &#8216;ain&#8217;, &#8216;aren&#8217;, &#8220;aren&#8217;t&#8221;, &#8216;couldn&#8217;, &#8220;couldn&#8217;t&#8221;, &#8216;didn&#8217;, &#8220;didn&#8217;t&#8221;, &#8216;doesn&#8217;, &#8220;doesn&#8217;t&#8221;, &#8216;hadn&#8217;, &#8220;hadn&#8217;t&#8221;, &#8216;hasn&#8217;, &#8220;hasn&#8217;t&#8221;, &#8216;haven&#8217;, &#8220;haven&#8217;t&#8221;, &#8216;isn&#8217;, &#8220;isn&#8217;t&#8221;, &#8216;ma&#8217;, &#8216;mightn&#8217;, &#8220;mightn&#8217;t&#8221;, &#8216;mustn&#8217;, &#8220;mustn&#8217;t&#8221;, &#8216;needn&#8217;, &#8220;needn&#8217;t&#8221;, &#8216;shan&#8217;, &#8220;shan&#8217;t&#8221;, &#8216;shouldn&#8217;, &#8220;shouldn&#8217;t&#8221;, &#8216;wasn&#8217;, &#8220;wasn&#8217;t&#8221;, &#8216;weren&#8217;, &#8220;weren&#8217;t&#8221;, &#8216;won&#8217;, &#8220;won&#8217;t&#8221;, &#8216;wouldn&#8217;, &#8220;wouldn&#8217;t&#8221;]<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from nltk.corpus import stopwords\r\n&gt;&gt;&gt; text=\"Today is a great day. It is even better than yesterday. And yesterday was the best day ever!\"\r\n&gt;&gt;&gt; stopwords=set(stopwords.words('english'))\r\n&gt;&gt;&gt; from nltk.tokenize import word_tokenize\r\n&gt;&gt;&gt; words=word_tokenize(text)\r\n&gt;&gt;&gt; wordsFiltered=[]\r\n&gt;&gt;&gt; for w in words:\r\n        if w not in stopwords:\r\n                 wordsFiltered.append(w)\r\n&gt;&gt;&gt; wordsFiltered<\/pre>\n<p><strong>[&#8216;Today&#8217;, &#8216;great&#8217;, &#8216;day&#8217;, &#8216;.&#8217;, &#8216;It&#8217;, &#8216;even&#8217;, &#8216;better&#8217;, &#8216;yesterday&#8217;, &#8216;.&#8217;, &#8216;And&#8217;, &#8216;yesterday&#8217;, &#8216;best&#8217;, &#8216;day&#8217;, &#8216;ever&#8217;, &#8216;!&#8217;]<\/strong><\/p>\n<h3>Speech Tagging with NLTK Python<\/h3>\n<p><span style=\"font-weight: 400\">NLTK can classify words as verbs, nouns, adjectives, and more into one of the following classes:<\/span><\/p>\n<div id=\"attachment_25197\" style=\"width: 824px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/speech-tagging.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-25197\" class=\"wp-image-25197 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/speech-tagging.png\" alt=\"NLTK Python Tutorial\" width=\"814\" height=\"258\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/speech-tagging.png 814w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/speech-tagging-150x48.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/speech-tagging-300x95.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/speech-tagging-768x243.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/a><p id=\"caption-attachment-25197\" class=\"wp-caption-text\">Python NLTK Tutorial &#8211; Speech Tagging<\/p><\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; import nltk\r\n&gt;&gt;&gt; from nltk.tokenize import PunktSentenceTokenizer\r\n&gt;&gt;&gt; text='I am a human being, capable of doing terrible things'\r\n&gt;&gt;&gt; sentences=nltk.sent_tokenize(text)\r\n&gt;&gt;&gt; for sent in sentences:\r\n        print(nltk.pos_tag(nltk.word_tokenize(sent)))<\/pre>\n<p><strong>[(&#8216;I&#8217;, &#8216;PRP&#8217;), (&#8216;am&#8217;, &#8216;VBP&#8217;), (&#8216;a&#8217;, &#8216;DT&#8217;), (&#8216;human&#8217;, &#8216;JJ&#8217;), (&#8216;being&#8217;, &#8216;VBG&#8217;), (&#8216;,&#8217;, &#8216;,&#8217;), (&#8216;capable&#8217;, &#8216;JJ&#8217;), (&#8216;of&#8217;, &#8216;IN&#8217;), (&#8216;doing&#8217;, &#8216;VBG&#8217;), (&#8216;terrible&#8217;, &#8216;JJ&#8217;), (&#8216;things&#8217;, &#8216;NNS&#8217;)]<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Match the arguments at position 1 with the table to figure out the output.<\/span><br \/>\nSo, this was all in the NLTK Python Tutorial. Hope you like our explanation.<\/p>\n<h3>Conclusion<\/h3>\n<p><span style=\"font-weight: 400\">Hence, in this NLTK Python Tutorial, we discussed the basics of Natural Language Processing with Python using NLTK. Moreover, we discussed tokenizing, stemming, lemmatization, finding synonyms and antonyms, speech tagging, and filtering out stop words. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Still, if you have any queries regarding the NLTK Python Tutorial, ask in the comments tab. You can also share your experience of reading this article through comments.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our last session, we discussed the NLP Tutorial. Today, in this NLTK Python Tutorial, we will learn to perform Natural Language Processing with NLTK. We will perform tasks like NLTK tokenize, removing stop&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":25217,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,46],"tags":[4708,6217,6781,9018,9075,9080,9082,9083,9084,9086,9087,10759,13190,13815,15830],"class_list":["post-25188","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-artificial-intelligence","category-python","tag-find-antonyms","tag-how-to-install-nltk","tag-install-nltk","tag-natural-language-toolkit","tag-nlp-tutorial","tag-nltk-sentence-tokenizer","tag-nltk-stop-words","tag-nltk-stopwords","tag-nltk-tokenize","tag-nltk-word_tokenize","tag-nltk-wordnet","tag-python-pip","tag-speech-tagging","tag-stemming-nltk","tag-what-is-nltk"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>NLTK(Natural Language Toolkit) Python Tutorial - DataFlair<\/title>\n<meta name=\"description\" content=\"The Natural Language Toolkit (NLTK) is a Python library used in NLP projects to perform tasks like tokenization, stemming &amp; lemmatization.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"NLTK(Natural Language Toolkit) Python Tutorial - DataFlair\" \/>\n<meta property=\"og:description\" content=\"The Natural Language Toolkit (NLTK) is a Python library used in NLP projects to perform tasks like tokenization, stemming &amp; lemmatization.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-20T04:17:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-29T06:07:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/NLTK-NLP-with-Python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"NLTK(Natural Language Toolkit) Python Tutorial - DataFlair","description":"The Natural Language Toolkit (NLTK) is a Python library used in NLP projects to perform tasks like tokenization, stemming & lemmatization.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"NLTK(Natural Language Toolkit) Python Tutorial - DataFlair","og_description":"The Natural Language Toolkit (NLTK) is a Python library used in NLP projects to perform tasks like tokenization, stemming & lemmatization.","og_url":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-08-20T04:17:46+00:00","article_modified_time":"2026-04-29T06:07:20+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/NLTK-NLP-with-Python.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"NLTK(Natural Language Toolkit) Python Tutorial","datePublished":"2018-08-20T04:17:46+00:00","dateModified":"2026-04-29T06:07:20+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/"},"wordCount":1382,"commentCount":6,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/NLTK-NLP-with-Python.jpg","keywords":["find antonyms","how to install NLTK","Install NLTK","Natural Language Toolkit","nlp Tutorial","NLTK Sentence Tokenizer","NLTK Stop Words","NLTK Stopwords","nltk tokenize","nltk word_tokenize","NLTK Wordnet","Python pip","Speech Tagging","Stemming NLTK","what is nltk"],"articleSection":["Artificial Intelligence Tutorials","Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/","url":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/","name":"NLTK(Natural Language Toolkit) Python Tutorial - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/NLTK-NLP-with-Python.jpg","datePublished":"2018-08-20T04:17:46+00:00","dateModified":"2026-04-29T06:07:20+00:00","description":"The Natural Language Toolkit (NLTK) is a Python library used in NLP projects to perform tasks like tokenization, stemming & lemmatization.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/NLTK-NLP-with-Python.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/NLTK-NLP-with-Python.jpg","width":1200,"height":628,"caption":"NLTK Python Tutorial (Natural Language Toolkit)"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/nltk-python-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Artificial Intelligence Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/artificial-intelligence\/"},{"@type":"ListItem","position":3,"name":"NLTK(Natural Language Toolkit) Python Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/25188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=25188"}],"version-history":[{"count":4,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/25188\/revisions"}],"predecessor-version":[{"id":148053,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/25188\/revisions\/148053"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/25217"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=25188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=25188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=25188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}