{"id":6180,"date":"2018-04-10T09:36:32","date_gmt":"2018-04-10T09:36:32","guid":{"rendered":"https:\/\/9series-blog.staging9.com\/?p=6180"},"modified":"2026-03-03T10:46:08","modified_gmt":"2026-03-03T10:46:08","slug":"natural-language-processing-works","status":"publish","type":"post","link":"https:\/\/www.9series.com\/blog\/natural-language-processing-works\/","title":{"rendered":"How Natural Language Processing Works?"},"content":{"rendered":"<p style=\"margin-top: 20px\"><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/How-Natural-Language-Processing-Works-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2894\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/How-Natural-Language-Processing-Works-.jpg\" alt=\"How-Natural-Language-Processing-Works-\" width=\"800\" height=\"500\" \/><\/a><\/p>\n<p>As we all know that Apple has introduced an API for natural language processing from iOS 5, which allows us to tokenize text, detect the language and determine parts of speech.<\/p>\n<p>Basically Natural Language Processing (NLP) is used to either predict your next word or suggest a correction while typing a word. NLP is likely used in Siri.<\/p>\n<p>The main API is NSLinguisticTagger which is used in analyzing and tagging text, segmenting content into paragraphs, sentences, and words. In iOS 11, NSLinguisticTagger becomes more powerful. It is used for following schemes,<\/p>\n<ul>\n<li>Identifying the specific language<\/li>\n<li>Tokenization: classifies each character as either a word, punctuation, or whitespace.<\/li>\n<li>Lemmatization: Identifies all the forms of a word.<\/li>\n<li>Parts of Speech: Breaks a sentence into nouns, verbs, and adjectives.<\/li>\n<li>Named entity recognition: It helps us identify whether the token is named entity like person name and place name.<\/li>\n<\/ul>\n<p style=\"margin-top: 20px\">Let\u2019s take experiment with the new NLP API. At first, we need to do is create a tagger. In NLP, a tagger can read the text and give different information to it such as part of speech, recognize names and languages, perform lemmatization etc.<\/p>\n<p>When you initialize NSLinguisticTagger, you have to pass in the tagSchemes in which you want to perform. Let\u2019s do it:<\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/11.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2901\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/11.jpg\" alt=\"1\" width=\"800\" height=\"112\" \/><\/a><\/p>\n<p style=\"margin-bottom: 0px\"><span style=\"font-weight: bold\">1. Language Identification<\/span><\/p>\n<p>You can retrieve this language by accessing the dominantLanguage property of the NSLinguisticTagger. NSLinguisticTagger analyzes the text to get the dominant language.<\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/21.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2902\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/21.jpg\" alt=\"2\" width=\"800\" height=\"70\" \/><\/a><\/p>\n<p style=\"margin-bottom: 0px\"><span style=\"font-weight: bold\">2. Tokenization<\/span><\/p>\n<p>The punctuations and whitespaces are omitted with NSLinguisticTagger Options. Tokenization is the process of classifying the text into paragraphs, sentences, and words. We call them tagger.enumerateTags function to tokenize.<\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/31.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2903\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/31.jpg\" alt=\"3\" width=\"800\" height=\"178\" \/><\/a><\/p>\n<p>It will be splitting the above string into words and then we get the list of each word that is there in the sentence.<\/p>\n<p style=\"margin-bottom: 0px\"><span style=\"font-weight: bold\">3. Lemmatization<\/span><\/p>\n<p>Deriving the dictionary form of the word is called Lemmatization. For example, a user wants the result for word <i>\u2018run\u2019<\/i>. if you were able to consider base forms of the word, you would be able to also get results for \u2018running\u2019, \u2018ran\u2019, \u2018will run\u2019, etc.<\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/41.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2904\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/41.jpg\" alt=\"4\" width=\"800\" height=\"180\" \/><\/a><\/p>\n<p>Here the raw value of the tag is lemma of a particular word. So In output we got is stem form of each word token.<\/p>\n<p style=\"margin-bottom: 0px\"><span style=\"font-weight: bold\">4. Parts of Speech<\/span><\/p>\n<p>This is used to get each token\u2019s lexical class. It will return each word and its part of speech. You can see the noun, preposition, verb, adjective, or determiner.<\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/53.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2905\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/53.jpg\" alt=\"5\" width=\"800\" height=\"201\" \/><\/a><\/p>\n<p>In the output, You can see the verbs, nouns, prepositions, adjectives, etc.<\/p>\n<p style=\"margin-bottom: 0px\"><span style=\"font-weight: bold\">5. Named Entity Recognition<\/span><\/p>\n<p>Named Entity Recognition is allowing you to recognize any names, organizations, or places. You would have seen certain keywords highlighted like numbers, names when you use some iPhone application.<\/p>\n<p>In the following example we identify whether the token is named entity like personal name and place name.<\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/61.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2906\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/04\/61.jpg\" alt=\"6\" width=\"800\" height=\"244\" \/><\/a><\/p>\n<p>Here we have used tag variable which is used by tagger to look for particular tags in sentence.<\/p>\n<p style=\"margin-bottom: 0px\"><span style=\"font-weight: bold\">Conclusion<\/span><\/p>\n<p>Natural Language Processing is already a powerful tool, growing exponentially and that can be widely used in the Applications. Apple\u2019s Siri and Facebook\u2019s messenger bots are the best examples of NLP.<\/p>\n<p>In this article, we, <a href=\"http:\/\/www.9series.com\/\" target=\"_blank\" rel=\"noopener\">9series<\/a>, have covered about NLP, its terms and how it works. If you have more experience with it or find more features then feel free to share your own experience with us.<\/p>\n<p>Stay tuned for upcoming articles.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As we all know that Apple has introduced an API for natural language processing from iOS 5, which allows us to tokenize text, detect the language and determine parts of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":6181,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"dsgo_overlay_header":false,"dsgo_overlay_header_text_color":"","dsgo_overlay_skip_top_bar":false,"_designsetgo_exclude_llms":false,"footnotes":""},"categories":[1428,1439],"tags":[1698,2101,1833,2158,2159,2160,1536,2161,2162,2163,2164,2165,2166,2167,2168],"class_list":["post-6180","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apple-2","category-ios","tag-3d-mobile-app","tag-accelerator-mobile-app-development","tag-ios-app-development","tag-iphone-application-development","tag-language-identification","tag-lemmatization","tag-mobile-apps","tag-named-entity-recognition","tag-natural-language-processing","tag-nlp-api","tag-nslinguistictagger","tag-parts-of-speech","tag-predictive-keyboard","tag-siri","tag-tokenization"],"_links":{"self":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts\/6180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/comments?post=6180"}],"version-history":[{"count":1,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts\/6180\/revisions"}],"predecessor-version":[{"id":6188,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts\/6180\/revisions\/6188"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/media\/6181"}],"wp:attachment":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/media?parent=6180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/categories?post=6180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/tags?post=6180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}