|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "Basic Sentiment Analysis Using TextBlob" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "code", |
| 12 | + "execution_count": 1, |
| 13 | + "metadata": {}, |
| 14 | + "outputs": [], |
| 15 | + "source": [ |
| 16 | + "from textblob import TextBlob" |
| 17 | + ] |
| 18 | + }, |
| 19 | + { |
| 20 | + "cell_type": "code", |
| 21 | + "execution_count": 17, |
| 22 | + "metadata": {}, |
| 23 | + "outputs": [], |
| 24 | + "source": [ |
| 25 | + "feedback1 = \"The Movies Was Awesome\"\n", |
| 26 | + "feedback2 = \"The Movies was Average\"\n", |
| 27 | + "feedback3 = \"The Movie was Good\"\n", |
| 28 | + "feedback4 = \"The Movies Was Intresting\"" |
| 29 | + ] |
| 30 | + }, |
| 31 | + { |
| 32 | + "cell_type": "code", |
| 33 | + "execution_count": 18, |
| 34 | + "metadata": {}, |
| 35 | + "outputs": [], |
| 36 | + "source": [ |
| 37 | + "blob1 = TextBlob(feedback1)\n", |
| 38 | + "blob2 = TextBlob(feedback2)\n", |
| 39 | + "blob3 = TextBlob(feedback3)\n", |
| 40 | + "blob4 = TextBlob(feedback4)" |
| 41 | + ] |
| 42 | + }, |
| 43 | + { |
| 44 | + "cell_type": "code", |
| 45 | + "execution_count": 19, |
| 46 | + "metadata": {}, |
| 47 | + "outputs": [ |
| 48 | + { |
| 49 | + "name": "stdout", |
| 50 | + "output_type": "stream", |
| 51 | + "text": [ |
| 52 | + "Sentiment(polarity=1.0, subjectivity=1.0)\n", |
| 53 | + "Sentiment(polarity=-0.15, subjectivity=0.39999999999999997)\n", |
| 54 | + "Sentiment(polarity=0.7, subjectivity=0.6000000000000001)\n", |
| 55 | + "Sentiment(polarity=0.0, subjectivity=0.0)\n" |
| 56 | + ] |
| 57 | + } |
| 58 | + ], |
| 59 | + "source": [ |
| 60 | + "print(blob1.sentiment)\n", |
| 61 | + "print(blob2.sentiment)\n", |
| 62 | + "print(blob3.sentiment)\n", |
| 63 | + "print(blob4.sentiment)" |
| 64 | + ] |
| 65 | + }, |
| 66 | + { |
| 67 | + "cell_type": "code", |
| 68 | + "execution_count": null, |
| 69 | + "metadata": {}, |
| 70 | + "outputs": [], |
| 71 | + "source": [] |
| 72 | + } |
| 73 | + ], |
| 74 | + "metadata": { |
| 75 | + "kernelspec": { |
| 76 | + "display_name": "Python 3", |
| 77 | + "language": "python", |
| 78 | + "name": "python3" |
| 79 | + }, |
| 80 | + "language_info": { |
| 81 | + "codemirror_mode": { |
| 82 | + "name": "ipython", |
| 83 | + "version": 3 |
| 84 | + }, |
| 85 | + "file_extension": ".py", |
| 86 | + "mimetype": "text/x-python", |
| 87 | + "name": "python", |
| 88 | + "nbconvert_exporter": "python", |
| 89 | + "pygments_lexer": "ipython3", |
| 90 | + "version": "3.7.4" |
| 91 | + } |
| 92 | + }, |
| 93 | + "nbformat": 4, |
| 94 | + "nbformat_minor": 2 |
| 95 | +} |
0 commit comments