{"id":8023,"date":"2023-10-25T14:31:21","date_gmt":"2023-10-25T22:31:21","guid":{"rendered":"https:\/\/live-cometml.pantheonsite.io\/?p=8023"},"modified":"2025-04-24T17:05:17","modified_gmt":"2025-04-24T17:05:17","slug":"sentiment-analysis-with-sparknlp-and-comet","status":"publish","type":"post","link":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet\/","title":{"rendered":"Sentiment Analysis With SparkNLP and Comet"},"content":{"rendered":"\n<div class=\"fk fl fm fn fo\">\n<div class=\"ab ca\">\n<div class=\"ch bg ew ex ey ez\">\n<figure class=\"lz ma mb mc md me lw lx paragraph-image\">\n<div class=\"mf mg ee mh bg mi\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mj mk c\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*crmBmr5sXOkj44ZNzZY2fw.jpeg\" alt=\"A desk full of graphs and charts with a magnifying glass, a few pens, and a pair of eyeglasses lying on top.\" width=\"700\" height=\"467\"><\/figure><div class=\"lw lx ly\"><picture><\/picture><\/div>\n<\/div><figcaption class=\"ml mm mn lw lx mo mp be b bf z dw\" data-selectable-paragraph=\"\">Picture by <a class=\"af mq\" href=\"https:\/\/www.pexels.com\/@anna-nekrashevich\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Anna Nekrashevich<\/a>, Pexels.com<\/figcaption><\/figure>\n<h1 id=\"a44b\" class=\"mr ms fr be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj\" data-selectable-paragraph=\"\">Introduction<\/h1>\n<p id=\"77ac\" class=\"pw-post-body-paragraph np nq fr be b nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok ol fk bj\" data-selectable-paragraph=\"\">Sentiment analysis is a natural language processing technique which identifies and extracts subjective information from source materials using computational linguistics and text analysis. It is employed to ascertain a speaker\u2019s or writer\u2019s feelings, attitudes, and opinions with regard to a particular subject or general contextual polarity of a work. Applications for sentiment analysis include market research, customer service, and social media monitoring. Among other things, companies use it to get insight from their customers on social media and know what is being said about their products.<\/p>\n<p id=\"5767\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">Spark NLP is a natural language processing library built on Apache Spark. It is used to carry out precise annotation for machine learning pipelines that can scale quickly in a distributed environment.<\/p>\n<p id=\"7400\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">We will build a pipeline for performing sentiment analysis on text data using the Spark NLP library and use Comet to monitor the metrics of our model. Comet is an online platform that allows you to track and monitor logs experiments and we are using Comet in this tutorial to track the metrics of our model.<\/p>\n<p id=\"ae4e\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">But first, let\u2019s understand how sentiment analysis works.<\/p>\n<h1 id=\"1230\" class=\"mr ms fr be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj\" data-selectable-paragraph=\"\">Sentiment Analysis<\/h1>\n<p id=\"8380\" class=\"pw-post-body-paragraph np nq fr be b nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok ol fk bj\" data-selectable-paragraph=\"\">One common approach to sentiment analysis is using supervised machine learning techniques to classify text into various sentiment categories, such as positive, negative, or neutral. This is often done by training a classifier on a labeled dataset of text, where each piece of text has been manually annotated with a sentiment label. Once the classifier is trained, it can be used to classify new text into the appropriate sentiment category.<\/p>\n<p id=\"fead\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">Another approach is to use lexicon-based methods, which involve looking up words or phrases in a pre-defined lexicon to determine the sentiment. This can be done by using a lexicon of positive and negative words and counting the number of positive and negative words in the text. The sentiment of the text is then determined based on the ratio of positive to negative words.<\/p>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"fk fl fm fn fo\">\n<div class=\"ab ca\">\n<div class=\"ch bg ew ex ey ez\">\n<blockquote class=\"oz\"><p id=\"6b75\" class=\"pa pb fr be pc pd pe pf pg ph pi ol dw\" data-selectable-paragraph=\"\">How does the team at Uber manage to keep their data organized and their team united? Comet\u2019s experiment tracking. <a class=\"af mq\" href=\"https:\/\/www.comet.com\/site\/customers\/uber\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Learn more from Uber\u2019s Olcay Cirit<\/a>.<\/p><\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"ab ca or os ot ou\" role=\"separator\"><span style=\"font-family: var(--wpex-body-font-family, var(--wpex-font-sans)); font-size: var(--wpex-body-font-size, 13px);\">Now let\u2019s begin by installing the necessary packages:<\/span><\/div>\n\n\n\n<div class=\"fk fl fm fn fo\">\n<div class=\"ab ca\">\n<div class=\"ch bg ew ex ey ez\">\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"b1d0\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\">\u200b\u200bpip install spark-nlp==4.2.6\npip install comet_ml<\/span><\/pre>\n<figure class=\"pj pk pl pm pn me lw lx paragraph-image\">\n<div class=\"mf mg ee mh bg mi\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mj mk c\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png\" alt=\"A screenshot of the Comet ML homepage with the logo \u201cless friction, more ML.\u201d\" width=\"700\" height=\"339\"><\/figure><div class=\"lw lx px\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*cX2fG8Jwc8_bIYfiAcUR5Q.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<figcaption class=\"ml mm mn lw lx mo mp be b bf z dw\" data-selectable-paragraph=\"\">Comet homepage<\/figcaption>\n<\/figure>\n<p id=\"c774\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">If you don\u2019t already have a Comet account, you can <a class=\"af mq\" href=\"http:\/\/www.comet.com\/site\" target=\"_blank\" rel=\"noopener ugc nofollow\">create one here<\/a>. Once your account is set up, you can manually create a project from the UI, or, as you\u2019ll see in this tutorial, we can create our project with a simple experiment parameter.<\/p>\n<figure class=\"pj pk pl pm pn me lw lx paragraph-image\">\n<div class=\"mf mg ee mh bg mi\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mj mk c\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*9beLdArlH7aWPPIBWVgfEQ.png\" alt=\"A screenshot of the Comet ML interface when manually creating a new project; there is a text box with options for \u201cName,\u201d \u201cDescription,\u201d and \u201cProject Visibility.\u201d\" width=\"700\" height=\"340\"><\/figure><div class=\"lw lx py\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*9beLdArlH7aWPPIBWVgfEQ.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*9beLdArlH7aWPPIBWVgfEQ.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*9beLdArlH7aWPPIBWVgfEQ.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*9beLdArlH7aWPPIBWVgfEQ.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*9beLdArlH7aWPPIBWVgfEQ.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*9beLdArlH7aWPPIBWVgfEQ.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*9beLdArlH7aWPPIBWVgfEQ.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*9beLdArlH7aWPPIBWVgfEQ.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*9beLdArlH7aWPPIBWVgfEQ.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*9beLdArlH7aWPPIBWVgfEQ.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*9beLdArlH7aWPPIBWVgfEQ.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*9beLdArlH7aWPPIBWVgfEQ.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*9beLdArlH7aWPPIBWVgfEQ.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*9beLdArlH7aWPPIBWVgfEQ.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<figcaption class=\"ml mm mn lw lx mo mp be b bf z dw\" data-selectable-paragraph=\"\">Creating a new Comet project manually in the UI<\/figcaption>\n<\/figure>\n<p id=\"2ffd\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">After creating an account, navigate to the top right of the Comet website and click on your avatar. Then select Account Settings and finally pick the API keys tab and generate an API key.<\/p>\n<figure class=\"pj pk pl pm pn me lw lx paragraph-image\">\n<div class=\"mf mg ee mh bg mi\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mj mk c\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*U7mC-awhcIX-sfw7Rm7wNA.png\" alt=\"A screenshot of the Account Settings tab within the Comet UI indicating where to find your personalized API key.\" width=\"700\" height=\"336\"><\/figure><div class=\"lw lx pz\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*U7mC-awhcIX-sfw7Rm7wNA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*U7mC-awhcIX-sfw7Rm7wNA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*U7mC-awhcIX-sfw7Rm7wNA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*U7mC-awhcIX-sfw7Rm7wNA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*U7mC-awhcIX-sfw7Rm7wNA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*U7mC-awhcIX-sfw7Rm7wNA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*U7mC-awhcIX-sfw7Rm7wNA.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*U7mC-awhcIX-sfw7Rm7wNA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*U7mC-awhcIX-sfw7Rm7wNA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*U7mC-awhcIX-sfw7Rm7wNA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*U7mC-awhcIX-sfw7Rm7wNA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*U7mC-awhcIX-sfw7Rm7wNA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*U7mC-awhcIX-sfw7Rm7wNA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*U7mC-awhcIX-sfw7Rm7wNA.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<figcaption class=\"ml mm mn lw lx mo mp be b bf z dw\" data-selectable-paragraph=\"\">Getting API keys<\/figcaption>\n<\/figure>\n<p id=\"086e\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">Now let\u2019s import our libraries:<\/p>\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"c2da\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\"><span class=\"hljs-comment\"># Import Spark NLP<\/span>\n<span class=\"hljs-keyword\">import<\/span> sparknlp\n<span class=\"hljs-keyword\">from<\/span> sparknlp.base <span class=\"hljs-keyword\">import<\/span> *\n<span class=\"hljs-keyword\">from<\/span> sparknlp.annotator <span class=\"hljs-keyword\">import<\/span> *\n<span class=\"hljs-keyword\">from<\/span> sparknlp.pretrained <span class=\"hljs-keyword\">import<\/span> PretrainedPipeline\n\n\n<span class=\"hljs-keyword\">from<\/span> pyspark.ml <span class=\"hljs-keyword\">import<\/span> Pipeline\n<span class=\"hljs-keyword\">from<\/span> pyspark.sql <span class=\"hljs-keyword\">import<\/span> SparkSession\n<span class=\"hljs-keyword\">import<\/span> pyspark.sql.functions <span class=\"hljs-keyword\">as<\/span> F\n\nspark = sparknlp.start()\n\n<span class=\"hljs-comment\"># Import comet<\/span>\n<span class=\"hljs-keyword\">import<\/span> comet_ml\n<span class=\"hljs-keyword\">from<\/span> sparknlp.logging.comet <span class=\"hljs-keyword\">import<\/span> CometLogger<\/span><\/pre>\n<p id=\"3d1b\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">Note that <a class=\"af mq\" href=\"https:\/\/nlp.johnsnowlabs.com\/api\/python\/third_party\/Comet.html\" target=\"_blank\" rel=\"noopener ugc nofollow\">Comet integrates with Spark automatically<\/a>. Next, we instantiate our experiment object:<\/p>\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"ba71\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\">experiment = comet_ml.Experiment(<span class=\"hljs-string\">\"YOUR-API-KEY\"<\/span>)<\/span><\/pre>\n<p id=\"f8ff\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">Now we\u2019ll give our project a name using the <code class=\"cw qa qb qc pp b\">project_name<\/code> parameter:<\/p>\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"85c1\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\">comet_ml.login(project_name=<span class=\"hljs-string\">'test-sparknlp '<\/span>)<\/span><\/pre>\n<p id=\"1bc1\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">Next, we start Spark, set the logger, and set an output log path:<\/p>\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"2e0c\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\">spark = sparknlp.start()\nlogger = CometLogger()\nOUTPUT_LOG_PATH = <span class=\"hljs-string\">\".\/run\"<\/span><\/span><\/pre>\n<h1 id=\"f8d9\" class=\"mr ms fr be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj\" data-selectable-paragraph=\"\">Building the pipeline<\/h1>\n<p id=\"721b\" class=\"pw-post-body-paragraph np nq fr be b nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok ol fk bj\" data-selectable-paragraph=\"\">We have five stages in our pipeline:<\/p>\n<ol class=\"\">\n<li id=\"4e80\" class=\"np nq fr be b nr om nt nu nv on nx ny nz qd ob oc od qe of og oh qf oj ok ol qg qh qi bj\" data-selectable-paragraph=\"\">The first stage is the <code class=\"cw qa qb qc pp b\">DocumentAssembler<\/code>, which creates a column from the text that is imputed. This allows us to easily use the text when we want to train the model.<\/li>\n<\/ol>\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"98fe\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\"><span class=\"hljs-comment\"># Create a document assembler<\/span>\ndocument = DocumentAssembler() \\\n    .setInputCol(<span class=\"hljs-string\">\"text\"<\/span>) \\\n    .setOutputCol(<span class=\"hljs-string\">\"document\"<\/span>)<\/span><\/pre>\n<p id=\"6cf6\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">2. The second stage is the <code class=\"cw qa qb qc pp b\">Tokenizer<\/code>, which tokenizes the text from the <code class=\"cw qa qb qc pp b\">document<\/code> column into separate words in the output as <code class=\"cw qa qb qc pp b\">token<\/code>. We don&#8217;t know what the input text will look like, so we\u2019ll have to format it to fit our guidelines by slicing sentences into words that our model can easily digest.<\/p>\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"b848\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\"><span class=\"hljs-comment\"># Create a tokenizer<\/span>\ntoken = Tokenizer() \\\n    .setInputCols([<span class=\"hljs-string\">\"document\"<\/span>]) \\\n    .setOutputCol(<span class=\"hljs-string\">\"token\"<\/span>)<\/span><\/pre>\n<p id=\"d622\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">3. The third step is the <code class=\"cw qa qb qc pp b\">Normalizer<\/code>, which removes the punctuation from the <code class=\"cw qa qb qc pp b\">token<\/code> column, makes the text lowercase, and then saves the output column as <code class=\"cw qa qb qc pp b\">normal<\/code>.<\/p>\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"4868\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\"><span class=\"hljs-comment\"># Create a normalizer<\/span>\nnormalizer = Normalizer() \\\n    .setInputCols([<span class=\"hljs-string\">\"token\"<\/span>]) \\\n    .setOutputCol(<span class=\"hljs-string\">\"normal\"<\/span>)<\/span><\/pre>\n<p id=\"2257\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">4. The fourth step is instantiating the <code class=\"cw qa qb qc pp b\">ViveknSentimentModel<\/code>. Here we\u2019re using a pre-trained model to classify the sentiment of the text as <code class=\"cw qa qb qc pp b\">positive<\/code>, <code class=\"cw qa qb qc pp b\">negative<\/code>, or <code class=\"cw qa qb qc pp b\">neutral<\/code> by taking the <code class=\"cw qa qb qc pp b\">document<\/code> and <code class=\"cw qa qb qc pp b\">normal<\/code> columns as input and setting its output column to <code class=\"cw qa qb qc pp b\">result_sentiment<\/code>. Now we\u2019re ready to actually train the model on our dataset.<\/p>\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"f011\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\"><span class=\"hljs-comment\"># Load a pretrained sentiment analysis model<\/span>\nvivekn = ViveknSentimentModel.pretrained() \\\n    .setInputCols([<span class=\"hljs-string\">\"document\"<\/span>, <span class=\"hljs-string\">\"normal\"<\/span>]) \\\n    .setOutputCol(<span class=\"hljs-string\">\"result_sentiment\"<\/span>)<\/span><\/pre>\n<p id=\"bd69\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">5. The fifth stage takes the output of the previous stage, <code class=\"cw qa qb qc pp b\">result_sentiment<\/code>and sets the final output column as <code class=\"cw qa qb qc pp b\">final_sentiment<\/code>. The aim is just to generate a final sentiment output for the user and save it as finisher.<\/p>\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"f897\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\"><span class=\"hljs-comment\"># Create a finisher<\/span>\nfinisher = Finisher() \\\n    .setInputCols([<span class=\"hljs-string\">\"result_sentiment\"<\/span>]) \\\n    .setOutputCols(<span class=\"hljs-string\">\"final_sentiment\"<\/span>)\n\nlogger.monitor(logdir=OUTPUT_LOG_PATH, model=vivekn)\n\n<span class=\"hljs-comment\"># Create a pipeline with all the stages<\/span>\npipeline = Pipeline().setStages([document, token, normalizer, vivekn, finisher])\n<\/span><\/pre>\n<p id=\"7dad\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">After creating the pipeline, let\u2019s fit in a small dataset of two sentences and get the sentiment of each of them displayed.<\/p>\n<pre class=\"pj pk pl pm pn po pp pq bo pr ba bj\"><span id=\"e4fb\" class=\"ps ms fr pp b bf pt pu l pv pw\" data-selectable-paragraph=\"\"><span class=\"hljs-comment\"># Create the data as a Spark dataframe<\/span>\ndata = spark.createDataFrame([\n    [<span class=\"hljs-string\">\"I recommend this movie\"<\/span>],\n    [<span class=\"hljs-string\">\"Dont waste your time!!!\"<\/span>]\n]).toDF(<span class=\"hljs-string\">\"text\"<\/span>)\n\n<span class=\"hljs-comment\"># Fit the pipeline to the data<\/span>\npipelineModel = pipeline.fit(data)\n\n<span class=\"hljs-comment\"># Transform the data and show the final sentiment<\/span>\nresult = pipelineModel.transform(data)\nresult.select(<span class=\"hljs-string\">\"final_sentiment\"<\/span>).show(truncate=<span class=\"hljs-literal\">False<\/span>)\nlogger.log_pipeline_parameters(pipelineModel)\nlogger.end()<\/span><\/pre>\n<figure class=\"pj pk pl pm pn me lw lx paragraph-image\">\n<div class=\"mf mg ee mh bg mi\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mj mk c\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*n6U624hwxxpIKB2XHHb0Lg.png\" alt=\"Screenshot of a dark mode IDE that defines the pipeline in Python for SparkNLP.\" width=\"700\" height=\"148\"><\/figure><div class=\"lw lx qj\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*n6U624hwxxpIKB2XHHb0Lg.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*n6U624hwxxpIKB2XHHb0Lg.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*n6U624hwxxpIKB2XHHb0Lg.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*n6U624hwxxpIKB2XHHb0Lg.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*n6U624hwxxpIKB2XHHb0Lg.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*n6U624hwxxpIKB2XHHb0Lg.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*n6U624hwxxpIKB2XHHb0Lg.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*n6U624hwxxpIKB2XHHb0Lg.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*n6U624hwxxpIKB2XHHb0Lg.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*n6U624hwxxpIKB2XHHb0Lg.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*n6U624hwxxpIKB2XHHb0Lg.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*n6U624hwxxpIKB2XHHb0Lg.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*n6U624hwxxpIKB2XHHb0Lg.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*n6U624hwxxpIKB2XHHb0Lg.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<\/figure>\n<p id=\"c58d\" class=\"pw-post-body-paragraph np nq fr be b nr om nt nu nv on nx ny nz oo ob oc od op of og oh oq oj ok ol fk bj\" data-selectable-paragraph=\"\">Now you can see the sentiment of the text that you passed it. You can display the evaluation metrics directly in your interactive notebook using the code below, or head over to the Comet UI to check out the results more in-depth.<\/p>\n<figure class=\"pj pk pl pm pn me lw lx paragraph-image\">\n<div class=\"mf mg ee mh bg mi\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mj mk c\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*Z323ED0GjCPzTxzA64-dgQ.png\" alt=\"A screenshot of the output of the model to the Comet interface.\" width=\"700\" height=\"351\"><\/figure><div class=\"lw lx qk\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*Z323ED0GjCPzTxzA64-dgQ.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*Z323ED0GjCPzTxzA64-dgQ.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*Z323ED0GjCPzTxzA64-dgQ.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*Z323ED0GjCPzTxzA64-dgQ.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*Z323ED0GjCPzTxzA64-dgQ.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*Z323ED0GjCPzTxzA64-dgQ.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*Z323ED0GjCPzTxzA64-dgQ.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*Z323ED0GjCPzTxzA64-dgQ.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*Z323ED0GjCPzTxzA64-dgQ.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*Z323ED0GjCPzTxzA64-dgQ.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*Z323ED0GjCPzTxzA64-dgQ.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*Z323ED0GjCPzTxzA64-dgQ.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*Z323ED0GjCPzTxzA64-dgQ.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*Z323ED0GjCPzTxzA64-dgQ.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<figcaption class=\"ml mm mn lw lx mo mp be b bf z dw\" data-selectable-paragraph=\"\">Comet dashboard<\/figcaption>\n<\/figure>\n<h1>Conclusion<\/h1>\n<p id=\"b756\" class=\"pw-post-body-paragraph np nq fr be b nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok ol fk bj\" data-selectable-paragraph=\"\">This is how to build a sentiment analysis pipeline with SparkNLP, while also using Comet to track your project metrics. You can check out the code on this <a class=\"af mq\" href=\"https:\/\/colab.research.google.com\/drive\/1l5Q73ipjA9QTUZjngfi9VrcN9Tl_kD8F?usp=sharing\" target=\"_blank\" rel=\"noopener ugc nofollow\">Colab notebook<\/a> to easily get started. There are many other cool ways to use Comet and you can check them out and try more examples from their <a class=\"af mq\" href=\"https:\/\/www.comet.com\/docs\/v2\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">documentation<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Picture by Anna Nekrashevich, Pexels.com Introduction Sentiment analysis is a natural language processing technique which identifies and extracts subjective information from source materials using computational linguistics and text analysis. It is employed to ascertain a speaker\u2019s or writer\u2019s feelings, attitudes, and opinions with regard to a particular subject or general contextual polarity of a work. [&hellip;]<\/p>\n","protected":false},"author":100,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"customer_name":"","customer_description":"","customer_industry":"","customer_technologies":"","customer_logo":"","footnotes":""},"categories":[9],"tags":[],"coauthors":[198],"class_list":["post-8023","post","type-post","status-publish","format-standard","hentry","category-product"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Sentiment Analysis With SparkNLP and Comet - Comet<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sentiment Analysis With SparkNLP and Comet\" \/>\n<meta property=\"og:description\" content=\"Picture by Anna Nekrashevich, Pexels.com Introduction Sentiment analysis is a natural language processing technique which identifies and extracts subjective information from source materials using computational linguistics and text analysis. It is employed to ascertain a speaker\u2019s or writer\u2019s feelings, attitudes, and opinions with regard to a particular subject or general contextual polarity of a work. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet\" \/>\n<meta property=\"og:site_name\" content=\"Comet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cometdotml\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-25T22:31:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-24T17:05:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*crmBmr5sXOkj44ZNzZY2fw.jpeg\" \/>\n<meta name=\"author\" content=\"Sandy M\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Cometml\" \/>\n<meta name=\"twitter:site\" content=\"@Cometml\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sandy M\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Sentiment Analysis With SparkNLP and Comet - Comet","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:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet","og_locale":"en_US","og_type":"article","og_title":"Sentiment Analysis With SparkNLP and Comet","og_description":"Picture by Anna Nekrashevich, Pexels.com Introduction Sentiment analysis is a natural language processing technique which identifies and extracts subjective information from source materials using computational linguistics and text analysis. It is employed to ascertain a speaker\u2019s or writer\u2019s feelings, attitudes, and opinions with regard to a particular subject or general contextual polarity of a work. [&hellip;]","og_url":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet","og_site_name":"Comet","article_publisher":"https:\/\/www.facebook.com\/cometdotml","article_published_time":"2023-10-25T22:31:21+00:00","article_modified_time":"2025-04-24T17:05:17+00:00","og_image":[{"url":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*crmBmr5sXOkj44ZNzZY2fw.jpeg","type":"","width":"","height":""}],"author":"Sandy M","twitter_card":"summary_large_image","twitter_creator":"@Cometml","twitter_site":"@Cometml","twitter_misc":{"Written by":"Sandy M","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet#article","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet\/"},"author":{"name":"Sandy M","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/46eba004d124beb6d3592cf6728f43d6"},"headline":"Sentiment Analysis With SparkNLP and Comet","datePublished":"2023-10-25T22:31:21+00:00","dateModified":"2025-04-24T17:05:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet\/"},"wordCount":829,"publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*crmBmr5sXOkj44ZNzZY2fw.jpeg","articleSection":["Product"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet\/","url":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet","name":"Sentiment Analysis With SparkNLP and Comet - Comet","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet#primaryimage"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*crmBmr5sXOkj44ZNzZY2fw.jpeg","datePublished":"2023-10-25T22:31:21+00:00","dateModified":"2025-04-24T17:05:17+00:00","breadcrumb":{"@id":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet#primaryimage","url":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*crmBmr5sXOkj44ZNzZY2fw.jpeg","contentUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*crmBmr5sXOkj44ZNzZY2fw.jpeg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.comet.com\/site\/blog\/sentiment-analysis-with-sparknlp-and-comet#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.comet.com\/site\/"},{"@type":"ListItem","position":2,"name":"Sentiment Analysis With SparkNLP and Comet"}]},{"@type":"WebSite","@id":"https:\/\/www.comet.com\/site\/#website","url":"https:\/\/www.comet.com\/site\/","name":"Comet","description":"Build Better Models Faster","publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.comet.com\/site\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.comet.com\/site\/#organization","name":"Comet ML, Inc.","alternateName":"Comet","url":"https:\/\/www.comet.com\/site\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","width":310,"height":310,"caption":"Comet ML, Inc."},"image":{"@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cometdotml","https:\/\/x.com\/Cometml","https:\/\/www.youtube.com\/channel\/UCmN63HKvfXSCS-UwVwmK8Hw"]},{"@type":"Person","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/46eba004d124beb6d3592cf6728f43d6","name":"Sandy M","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/image\/73e571000fd489681999ca76cba0070b","url":"https:\/\/secure.gravatar.com\/avatar\/b91e4581668129edd364e880f0a56403a4ab1598cbb65e62ca9348c6db10ba72?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b91e4581668129edd364e880f0a56403a4ab1598cbb65e62ca9348c6db10ba72?s=96&d=mm&r=g","caption":"Sandy M"},"url":"https:\/\/www.comet.com\/site\/blog\/author\/mondaysandy3gmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/8023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/users\/100"}],"replies":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/comments?post=8023"}],"version-history":[{"count":1,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/8023\/revisions"}],"predecessor-version":[{"id":15488,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/8023\/revisions\/15488"}],"wp:attachment":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/media?parent=8023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/categories?post=8023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/tags?post=8023"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/coauthors?post=8023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}