{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.11","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":2157,"sourceType":"datasetVersion","datasetId":18}],"dockerImageVersionId":31040,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\nplt.style.use('ggplot')\n\nimport nltk","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-05-16T12:09:53.762318Z","iopub.execute_input":"2025-05-16T12:09:53.762680Z","iopub.status.idle":"2025-05-16T12:09:53.768747Z","shell.execute_reply.started":"2025-05-16T12:09:53.762652Z","shell.execute_reply":"2025-05-16T12:09:53.767465Z"}},"outputs":[],"execution_count":142},{"cell_type":"code","source":"# Read in data\ndf = pd.read_csv('/kaggle/input/amazon-fine-food-reviews/Reviews.csv')\nprint(df.shape)\ndf = df.head(500)\nprint(df.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-16T12:09:55.047299Z","iopub.execute_input":"2025-05-16T12:09:55.047642Z","iopub.status.idle":"2025-05-16T12:09:59.654257Z","shell.execute_reply.started":"2025-05-16T12:09:55.047615Z","shell.execute_reply":"2025-05-16T12:09:59.653504Z"}},"outputs":[{"name":"stdout","text":"(568454, 10)\n(500, 10)\n","output_type":"stream"}],"execution_count":143},{"cell_type":"code","source":"ax = df['Score'].value_counts()\nax","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-16T12:10:03.031026Z","iopub.execute_input":"2025-05-16T12:10:03.031363Z","iopub.status.idle":"2025-05-16T12:10:03.038529Z","shell.execute_reply.started":"2025-05-16T12:10:03.031338Z","shell.execute_reply":"2025-05-16T12:10:03.037726Z"}},"outputs":[{"execution_count":147,"output_type":"execute_result","data":{"text/plain":"Score\n5 339\n4 70\n3 37\n1 36\n2 18\nName: count, dtype: int64"},"metadata":{}}],"execution_count":147},{"cell_type":"code","source":"#BAsic NLTK\nexample = df['Text'][50]\nprint(example)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-16T12:10:03.305406Z","iopub.execute_input":"2025-05-16T12:10:03.305964Z","iopub.status.idle":"2025-05-16T12:10:03.312420Z","shell.execute_reply.started":"2025-05-16T12:10:03.305931Z","shell.execute_reply":"2025-05-16T12:10:03.311186Z"}},"outputs":[{"name":"stdout","text":"This oatmeal is not good. Its mushy, soft, I don't like it. Quaker Oats is the way to go.\n","output_type":"stream"}],"execution_count":148},{"cell_type":"code","source":"df.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-16T12:10:03.519750Z","iopub.execute_input":"2025-05-16T12:10:03.520532Z","iopub.status.idle":"2025-05-16T12:10:03.532963Z","shell.execute_reply.started":"2025-05-16T12:10:03.520503Z","shell.execute_reply":"2025-05-16T12:10:03.531976Z"}},"outputs":[{"execution_count":149,"output_type":"execute_result","data":{"text/plain":" Id ProductId UserId ProfileName \\\n0 1 B001E4KFG0 A3SGXH7AUHU8GW delmartian \n1 2 B00813GRG4 A1D87F6ZCVE5NK dll pa \n2 3 B000LQOCH0 ABXLMWJIXXAIN Natalia Corres \"Natalia Corres\" \n3 4 B000UA0QIQ A395BORC6FGVXV Karl \n4 5 B006K2ZZ7K A1UQRSCLF8GW1T Michael D. Bigham \"M. Wassir\" \n\n HelpfulnessNumerator HelpfulnessDenominator Score Time \\\n0 1 1 5 1303862400 \n1 0 0 1 1346976000 \n2 1 1 4 1219017600 \n3 3 3 2 1307923200 \n4 0 0 5 1350777600 \n\n Summary Text \n0 Good Quality Dog Food I have bought several of the Vitality canned d... \n1 Not as Advertised Product arrived labeled as Jumbo Salted Peanut... \n2 \"Delight\" says it all This is a confection that has been around a fe... \n3 Cough Medicine If you are looking for the secret ingredient i... \n4 Great taffy Great taffy at a great price. There was a wid... ","text/html":"
\n | Id | \nProductId | \nUserId | \nProfileName | \nHelpfulnessNumerator | \nHelpfulnessDenominator | \nScore | \nTime | \nSummary | \nText | \n
---|---|---|---|---|---|---|---|---|---|---|
0 | \n1 | \nB001E4KFG0 | \nA3SGXH7AUHU8GW | \ndelmartian | \n1 | \n1 | \n5 | \n1303862400 | \nGood Quality Dog Food | \nI have bought several of the Vitality canned d... | \n
1 | \n2 | \nB00813GRG4 | \nA1D87F6ZCVE5NK | \ndll pa | \n0 | \n0 | \n1 | \n1346976000 | \nNot as Advertised | \nProduct arrived labeled as Jumbo Salted Peanut... | \n
2 | \n3 | \nB000LQOCH0 | \nABXLMWJIXXAIN | \nNatalia Corres \"Natalia Corres\" | \n1 | \n1 | \n4 | \n1219017600 | \n\"Delight\" says it all | \nThis is a confection that has been around a fe... | \n
3 | \n4 | \nB000UA0QIQ | \nA395BORC6FGVXV | \nKarl | \n3 | \n3 | \n2 | \n1307923200 | \nCough Medicine | \nIf you are looking for the secret ingredient i... | \n
4 | \n5 | \nB006K2ZZ7K | \nA1UQRSCLF8GW1T | \nMichael D. Bigham \"M. Wassir\" | \n0 | \n0 | \n5 | \n1350777600 | \nGreat taffy | \nGreat taffy at a great price. There was a wid... | \n
\n | Id | \nvader_neg | \nvader_neu | \nvader_pos | \nvader_compound | \nroberta_neg | \nroberta_neu | \nroberta_pos | \nProductId | \nUserId | \nProfileName | \nHelpfulnessNumerator | \nHelpfulnessDenominator | \nScore | \nTime | \nSummary | \nText | \nlabel | \n
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n1 | \n0.000 | \n0.695 | \n0.305 | \n0.9441 | \n0.009624 | \n0.049980 | \n0.940395 | \nB001E4KFG0 | \nA3SGXH7AUHU8GW | \ndelmartian | \n1 | \n1 | \n5 | \n1303862400 | \nGood Quality Dog Food | \nI have bought several of the Vitality canned d... | \n1 | \n
1 | \n2 | \n0.138 | \n0.862 | \n0.000 | \n-0.5664 | \n0.508986 | \n0.452414 | \n0.038600 | \nB00813GRG4 | \nA1D87F6ZCVE5NK | \ndll pa | \n0 | \n0 | \n1 | \n1346976000 | \nNot as Advertised | \nProduct arrived labeled as Jumbo Salted Peanut... | \n0 | \n
2 | \n3 | \n0.091 | \n0.754 | \n0.155 | \n0.8265 | \n0.003229 | \n0.098067 | \n0.898704 | \nB000LQOCH0 | \nABXLMWJIXXAIN | \nNatalia Corres \"Natalia Corres\" | \n1 | \n1 | \n4 | \n1219017600 | \n\"Delight\" says it all | \nThis is a confection that has been around a fe... | \n1 | \n
3 | \n4 | \n0.000 | \n1.000 | \n0.000 | \n0.0000 | \n0.002295 | \n0.090219 | \n0.907486 | \nB000UA0QIQ | \nA395BORC6FGVXV | \nKarl | \n3 | \n3 | \n2 | \n1307923200 | \nCough Medicine | \nIf you are looking for the secret ingredient i... | \n0 | \n
4 | \n5 | \n0.000 | \n0.552 | \n0.448 | \n0.9468 | \n0.001635 | \n0.010302 | \n0.988063 | \nB006K2ZZ7K | \nA1UQRSCLF8GW1T | \nMichael D. Bigham \"M. Wassir\" | \n0 | \n0 | \n5 | \n1350777600 | \nGreat taffy | \nGreat taffy at a great price. There was a wid... | \n1 | \n
... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n
456 | \n496 | \n0.000 | \n0.554 | \n0.446 | \n0.9725 | \n0.001906 | \n0.009862 | \n0.988232 | \nB000G6RYNE | \nAPGAA43E3WPN7 | \nDarren | \n0 | \n0 | \n5 | \n1201392000 | \namazing chips | \ni rarely eat chips but i saw these and tried t... | \n1 | \n
457 | \n497 | \n0.059 | \n0.799 | \n0.142 | \n0.7833 | \n0.004415 | \n0.034215 | \n0.961369 | \nB000G6RYNE | \nABR7HU5H1KNE | \nKeith | \n0 | \n0 | \n5 | \n1196726400 | \nBest Chip Ever | \nThis is easily the best potato chip that I hav... | \n1 | \n
458 | \n498 | \n0.025 | \n0.762 | \n0.212 | \n0.9848 | \n0.006427 | \n0.074537 | \n0.919036 | \nB000G6RYNE | \nAJQD2WWJYOYFQ | \nbubbles | \n0 | \n0 | \n4 | \n1186617600 | \nTangy, spicy, and sweet- oh my! | \nKettle Chips Spicy Thai potato chips have the ... | \n1 | \n
459 | \n499 | \n0.041 | \n0.904 | \n0.055 | \n0.1280 | \n0.865614 | \n0.119366 | \n0.015020 | \nB000G6RYNE | \nA16YH487W9ZYO0 | \nBruce G. Lindsay | \n0 | \n0 | \n4 | \n1184198400 | \nAn indulgence with a bite | \nOkay, I should not eat potato chips, nor shoul... | \n1 | \n
460 | \n500 | \n0.000 | \n0.678 | \n0.322 | \n0.9811 | \n0.002440 | \n0.011327 | \n0.986233 | \nB000G6RYNE | \nA83YQC1XOU4CS | \nJ. Baker | \n0 | \n0 | \n5 | \n1183420800 | \nThe best I've had | \nI don't write very many reviews but I have to ... | \n1 | \n
461 rows × 18 columns
\n