{"id":100161,"date":"2021-02-19T15:00:00","date_gmt":"2021-02-19T13:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=100161"},"modified":"2021-02-12T15:52:05","modified_gmt":"2021-02-12T13:52:05","slug":"nltk-natural-language-toolkit-tutorial-in-python","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/","title":{"rendered":"NLTK (Natural Language Toolkit) Tutorial in Python"},"content":{"rendered":"<p>Hello in this tutorial, we will understand how to use the NLTK (Natural Language Toolkit) in python programming.<\/p>\n<h2>1. Introduction<\/h2>\n<p><strong>NLTK<\/strong> is a powerful artificial intelligence subset present in python programming. This technique helps in manipulation and working with the text or speech with the help of programming magic. NLTK toolkit also provides an off box support to identify the named entities and do a part of speech (also known as <em>pos<\/em>) tagging for the grammar.<\/p>\n<h3>1.1 Setting up Python<\/h3>\n<p>If someone needs to go through the Python installation on Windows, please watch <a href=\"https:\/\/www.youtube.com\/watch?v=i-MuSAwgwCU\" target=\"_blank\" rel=\"noopener\">this<\/a> link. You can download the Python from <a href=\"https:\/\/www.python.org\/downloads\/\" target=\"_blank\" rel=\"noopener\">this<\/a> link.<\/p>\n<h3>1.2 Setting up NLTK in Python<\/h3>\n<p>Once the python is successfully installed on your system you can install the <strong>nltk<\/strong> toolkit using a simple <code>pip<\/code> command. You can fire the below command from the command prompt and it will successfully download the module from <a href=\"https:\/\/www.nltk.org\/\" target=\"_blank\" rel=\"noopener\">nltk<\/a> and install it.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Installation command<\/em><\/span><\/p>\n<pre class=\"brush:python;\">pip install nltk\n<\/pre>\n<h2>2. NLTK (Natural Language Toolkit) Tutorial in Python<\/h2>\n<p>Before going any deeper in the practical let us download important nltk packages.<\/p>\n<h3>2.1 Downloading packages<\/h3>\n<p>The approximate package size would be around ~3GB. To download the other packages we will use a simple python program which upon execution will open a dialogue box and you can click the download button to download and automatically install the packages.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>downloadnltkpackages.py<\/em><\/span><\/p>\n<pre class=\"brush:python;\"># download nltk packages\n# nltk stands for Natural Language Tool Kit\nimport nltk\n# command will open the download window for nltk\n# click the download button to download the dataset as shown in fig1\nnltk.download()\n<\/pre>\n<p>If everything goes well the following window would open where you can click the download button to download and install the packages (like collections, corpora, models, or all packages). My recommendation is to choose <em>all<\/em> packages as will require a majority of them in other practical implementations.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/download-nltk-packages-img1.jpg\"><img decoding=\"async\" width=\"573\" height=\"478\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/download-nltk-packages-img1.jpg\" alt=\"nltk python - downloading\" class=\"wp-image-100162\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/download-nltk-packages-img1.jpg 573w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/download-nltk-packages-img1-300x250.jpg 300w\" sizes=\"(max-width: 573px) 100vw, 573px\" \/><\/a><figcaption>Fig. 1: Downloading the NLTK packages<\/figcaption><\/figure>\n<\/div>\n<h3>2.2 Tokenizing sentences<\/h3>\n<p><strong>Tokenizing<\/strong> is a simple process of breaking up a sentence into a list of words and these words are known as tokens. There are 2 main tokenization techniques i.e.<\/p>\n<ul>\n<li><em>Sentence tokenization<\/em> \u2013 Refers to breaking up a sentence into paragraphs<\/li>\n<li><em>Word tokenization<\/em> \u2013 Refers to breaking up the words in a sentence<\/li>\n<\/ul>\n<p>Let us see a code implementation of how sentence tokenization works in python programming and for this, we will use the <code>sent_tokenize(\u2026)<\/code> method from the <code>nltk.tokenize.punkt<\/code> module. This method is well known to mark the beginning and end of sentences at character and punctuation.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>tokenizingsentences.py<\/em><\/span><\/p>\n<pre class=\"brush:python;\"># sentence tokenization\n# process of splitting up the sentence into a list of words and this list of words are known as tokens\nfrom nltk.tokenize import sent_tokenize\nrandom_text = \"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has \" \\\n              \"been the industry's standard dummy text ever since the 1500s, when an unknown printer took \" \\\n              \"a galley of type and scrambled it to make a type specimen book. It has survived not only five \" \\\n              \"centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It \" \\\n              \"was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum \" \\\n              \"passages, and more recently with desktop publishing software like Aldus PageMaker including \" \\\n              \"versions of Lorem Ipsum.\"\n# sent_tokenize(...) uses an instance of PunktSentenceTokenizer\ntokenized_sentences = sent_tokenize(random_text)\n# print(tokenized_sentences)\nfor idx, tokenized_sentence in enumerate(tokenized_sentences):\n    print('{} : {}'.format(idx, tokenized_sentence))\n<\/pre>\n<p>If everything goes well the following output will be shown in the IDE console.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span style=\"text-decoration: underline;\"><em>Logs<\/em><\/span><\/p>\n<pre class=\"brush:plain;\">0 : Lorem Ipsum is simply dummy text of the printing and typesetting industry.\n1 : Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.\n2 : It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.\n3 : It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.\n<\/pre>\n<h3>2.3 Tagging sentences<\/h3>\n<p><strong>Tagging<\/strong> is a simple process of reading a word and assigning it a specific token (popularly known as the part of speech). For tagging to work we use the <code>DefaultTagger<\/code> class. Some of them are \u2013<\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><strong>Abbreviation<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">CC<\/td>\n<td style=\"text-align: center;\">coordinating conjunction<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">DT<\/td>\n<td style=\"text-align: center;\">determiner<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">FW<\/td>\n<td style=\"text-align: center;\">foreign word<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">IN<\/td>\n<td style=\"text-align: center;\">preposition\/subordinating conjunction<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">JJ<\/td>\n<td style=\"text-align: center;\">adjective (large)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">JJR<\/td>\n<td style=\"text-align: center;\">adjective,comparative (larger)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">JJS<\/td>\n<td style=\"text-align: center;\">adjective,superlative (largest)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">NN<\/td>\n<td style=\"text-align: center;\">noun,singular (cat,tree)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">NNS<\/td>\n<td style=\"text-align: center;\">noun plural (desks)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">NNP<\/td>\n<td style=\"text-align: center;\">a proper noun, singular<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">NNPS<\/td>\n<td style=\"text-align: center;\">a proper noun, plural<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">RB<\/td>\n<td style=\"text-align: center;\">adverb (occasionally, swiftly)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">RBR<\/td>\n<td style=\"text-align: center;\">adverb,comparative (greater)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">TO<\/td>\n<td style=\"text-align: center;\">infinite marker (to)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">UH<\/td>\n<td style=\"text-align: center;\">interjection (goodbye)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">VB<\/td>\n<td style=\"text-align: center;\">verb (ask)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let us see a code implementation of word tagging in python programming.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>taggingsentences.py<\/em><\/span><\/p>\n<pre class=\"brush:python;\"># tagging sentences\n# tagging is responsible for reading a text in the language and assigning a specific token known to each word\n# pos tagger is used to assign grammatical information to each word in a sentence\n# importing part of speech tagging module\nfrom nltk import pos_tag\nrandom_text = \"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has \" \\\n              \"been the industry's standard dummy text ever since the 1500s, when an unknown printer took \" \\\n              \"a galley of type and scrambled it to make a type specimen book. It has survived not only five \" \\\n              \"centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It \" \\\n              \"was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum \" \\\n              \"passages, and more recently with desktop publishing software like Aldus PageMaker including \" \\\n              \"versions of Lorem Ipsum.\".split()\n\ntags = pos_tag(random_text)\n# print(tags)\nfor idx, tag in enumerate(tags):\n    print('{} : {}'.format(idx, tag))\n<\/pre>\n<p>If everything goes well the following output will be shown in the IDE console.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Logs<\/em><\/span><\/p>\n<pre class=\"brush:plain;\">0 : ('Lorem', 'NNP')\n1 : ('Ipsum', 'NNP')\n2 : ('is', 'VBZ')\n3 : ('simply', 'RB')\n4 : ('dummy', 'JJ')\n5 : ('text', 'NN')\n6 : ('of', 'IN')\n7 : ('the', 'DT')\n8 : ('printing', 'NN')\n9 : ('and', 'CC')\n10 : ('typesetting', 'NN')\n11 : ('industry.', 'NN')\n12 : ('Lorem', 'NNP')\n\n\/\/ other statement omitted for brevity . . .\n<\/pre>\n<h3>2.4 Counting tags<\/h3>\n<p>As in the previous section, we saw how we can use tagging. Once the tagging of words is done it is important to understand the counting as well. Let us see a code implementation of how one can count tags.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>countingtags.py<\/em><\/span><\/p>\n<pre class=\"brush:python;\"># tagging sentences and counting them\n# importing the counter module for counting the elements\nfrom collections import Counter\n# importing part of speech tagging module\nfrom nltk import pos_tag\nrandom_text = \"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has \" \\\n              \"been the industry's standard dummy text ever since the 1500s, when an unknown printer took \" \\\n              \"a galley of type and scrambled it to make a type specimen book. It has survived not only five \" \\\n              \"centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It \" \\\n              \"was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum \" \\\n              \"passages, and more recently with desktop publishing software like Aldus PageMaker including \" \\\n              \"versions of Lorem Ipsum.\".split()\ntags = pos_tag(random_text)\n# print(tags)\n# counting tags are important for the natural language operations\n# counter is a container that keeps the count of each element present in the container\ncounts = Counter(tag for word, tag in tags)\nprint(counts)\n<\/pre>\n<p>If everything goes well the following output will be shown in the IDE console.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Logs<\/em><\/span><\/p>\n<pre class=\"brush:plain;\">Counter({'NN': 20, 'NNP': 11, 'IN': 10, 'DT': 9, 'RB': 7, 'JJ': 5, 'CC': 4, 'NNS': 4, 'VBZ': 3, 'VBN': 3, 'VBD': 3, 'PRP': 3, 'VBG': 3, 'CD': 2, 'WRB': 1, 'TO': 1, 'VB': 1, 'RBR': 1})\n<\/pre>\n<p>That is all for this tutorial and I hope the article served you with whatever you were looking for. Happy Learning and do not forget to share!<\/p>\n<h2>3. Summary<\/h2>\n<p>In this tutorial, we learned:<\/p>\n<ul>\n<li>Introduction to nltk module in Python<\/li>\n<li>Sample program to understanding sentence tokenization, tagging, and counting of tags in python programming via nltk module<\/li>\n<\/ul>\n<p>You can download the source code of this tutorial from the <a href=\"#projectDownload\">Downloads<\/a> section.<\/p>\n<h2><a name=\"projectDownload\"><\/a>4. Download the Project<\/h2>\n<p>This was a tutorial to understand the NLTK (Natural Language Toolkit) in python programming.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>You can download the full source code of this example here: <a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/NLTK-Natural-Language-Toolkit-Tutorial-in-Python.zip\" target=\"_blank\" rel=\"noopener\"><strong>NLTK (Natural Language Toolkit) Tutorial in Python<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello in this tutorial, we will understand how to use the NLTK (Natural Language Toolkit) in python programming. 1. Introduction NLTK is a powerful artificial intelligence subset present in python programming. This technique helps in manipulation and working with the text or speech with the help of programming magic. NLTK toolkit also provides an off &hellip;<\/p>\n","protected":false},"author":119,"featured_media":99891,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46689],"tags":[1716],"class_list":["post-100161","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>NLTK (Natural Language Toolkit) in Python - Examples Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Hello in this tutorial, we will understand how to use the NLTK (Natural Language Toolkit) in python programming. 1. Introduction NLTK is a powerful\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/\" \/>\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) in Python - Examples Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Hello in this tutorial, we will understand how to use the NLTK (Natural Language Toolkit) in python programming. 1. Introduction NLTK is a powerful\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2021-02-19T13:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Yatin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Yatin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/\"},\"author\":{\"name\":\"Yatin\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/9874407a37b028e8be3276e2b5960d13\"},\"headline\":\"NLTK (Natural Language Toolkit) Tutorial in Python\",\"datePublished\":\"2021-02-19T13:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/\"},\"wordCount\":676,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"keywords\":[\"python\"],\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/\",\"name\":\"NLTK (Natural Language Toolkit) in Python - Examples Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"datePublished\":\"2021-02-19T13:00:00+00:00\",\"description\":\"Hello in this tutorial, we will understand how to use the NLTK (Natural Language Toolkit) in python programming. 1. Introduction NLTK is a powerful\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"set python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/web-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/web-development\/python\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"NLTK (Natural Language Toolkit) Tutorial in Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/9874407a37b028e8be3276e2b5960d13\",\"name\":\"Yatin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg\",\"caption\":\"Yatin\"},\"description\":\"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).\",\"sameAs\":[\"https:\/\/www.javacodegeeks.com\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/yatin-batra\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"NLTK (Natural Language Toolkit) in Python - Examples Java Code Geeks","description":"Hello in this tutorial, we will understand how to use the NLTK (Natural Language Toolkit) in python programming. 1. Introduction NLTK is a powerful","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:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/","og_locale":"en_US","og_type":"article","og_title":"NLTK (Natural Language Toolkit) in Python - Examples Java Code Geeks","og_description":"Hello in this tutorial, we will understand how to use the NLTK (Natural Language Toolkit) in python programming. 1. Introduction NLTK is a powerful","og_url":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2021-02-19T13:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","type":"image\/jpeg"}],"author":"Yatin","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Yatin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/"},"author":{"name":"Yatin","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/9874407a37b028e8be3276e2b5960d13"},"headline":"NLTK (Natural Language Toolkit) Tutorial in Python","datePublished":"2021-02-19T13:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/"},"wordCount":676,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","keywords":["python"],"articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/","url":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/","name":"NLTK (Natural Language Toolkit) in Python - Examples Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","datePublished":"2021-02-19T13:00:00+00:00","description":"Hello in this tutorial, we will understand how to use the NLTK (Natural Language Toolkit) in python programming. 1. Introduction NLTK is a powerful","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","width":150,"height":150,"caption":"set python"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/nltk-natural-language-toolkit-tutorial-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Web Development","item":"https:\/\/examples.javacodegeeks.com\/category\/web-development\/"},{"@type":"ListItem","position":3,"name":"Python","item":"https:\/\/examples.javacodegeeks.com\/category\/web-development\/python\/"},{"@type":"ListItem","position":4,"name":"NLTK (Natural Language Toolkit) Tutorial in Python"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/9874407a37b028e8be3276e2b5960d13","name":"Yatin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg","caption":"Yatin"},"description":"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/examples.javacodegeeks.com\/author\/yatin-batra\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/100161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/119"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=100161"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/100161\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/99891"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=100161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=100161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=100161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}