diff --git a/POS_Tagging_Muhammad_Hafiz_Fassya.ipynb b/POS_Tagging_Muhammad_Hafiz_Fassya.ipynb new file mode 100644 index 0000000..67f9248 --- /dev/null +++ b/POS_Tagging_Muhammad_Hafiz_Fassya.ipynb @@ -0,0 +1,1494 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + }, + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "version_major": 2, + "version_minor": 0, + "state": { + "9b0359b5095147e984e073d823aeedf7": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_d692de17dcea4f5ab3e473493f3f5f32", + "IPY_MODEL_c6bb8c98ae6741a69d9e13b2f7785e1c", + "IPY_MODEL_6e40eba3b0c54023af9242c2c5e4b12a" + ], + "layout": "IPY_MODEL_2cae0b4992e5400bbf5a55780eb36494" + } + }, + "d692de17dcea4f5ab3e473493f3f5f32": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_75899e0d92dd4884952efba1f69650f4", + "placeholder": "", + "style": "IPY_MODEL_6c4d77e529ea4b6bae159dca04aa2472", + "value": "Downloading https://raw.githubusercontent.com/stanfordnlp/stanza-resources/main/resources_1.15.0.json: " + } + }, + "c6bb8c98ae6741a69d9e13b2f7785e1c": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_f3945a9bb1fa4422964689a14ff4835c", + "max": 66336, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_9f5084c569bc4a1192a360afbecd668c", + "value": 66336 + } + }, + "6e40eba3b0c54023af9242c2c5e4b12a": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_9c02c910ce364b3da4dfb65b530bffcc", + "placeholder": "", + "style": "IPY_MODEL_e397441ad19d4e9c8aa8a1396e342875", + "value": " 535k/? [00:00<00:00, 40.6MB/s]" + } + }, + "2cae0b4992e5400bbf5a55780eb36494": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "75899e0d92dd4884952efba1f69650f4": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "6c4d77e529ea4b6bae159dca04aa2472": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "f3945a9bb1fa4422964689a14ff4835c": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "9f5084c569bc4a1192a360afbecd668c": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "9c02c910ce364b3da4dfb65b530bffcc": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "e397441ad19d4e9c8aa8a1396e342875": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "aaacf7f0ebfd4679be3f8f6f4dc7b927": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_1e8f4a3d737647bb8e0e4bf069cf600f", + "IPY_MODEL_dcc428a4ef124e0e86f7889cebfa6de8", + "IPY_MODEL_a9d17a8422f5496180adffb66f1e637b" + ], + "layout": "IPY_MODEL_e3ee2d8c59984b5db852a1b817f059ce" + } + }, + "1e8f4a3d737647bb8e0e4bf069cf600f": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_c091a4f8633d45a7b7b2edf586ea0061", + "placeholder": "", + "style": "IPY_MODEL_596bc1fb1b894a1b85b5384334272fb3", + "value": "Downloading https://raw.githubusercontent.com/stanfordnlp/stanza-resources/main/resources_1.15.0.json: " + } + }, + "dcc428a4ef124e0e86f7889cebfa6de8": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_1a46600352554561846be7952e8011ff", + "max": 66336, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_029fc3701fae42cb850a3e5f7f06fcab", + "value": 66336 + } + }, + "a9d17a8422f5496180adffb66f1e637b": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_e24605ca213a411c98c2a61a083b2a31", + "placeholder": "", + "style": "IPY_MODEL_ba3330e94ef14ed4aed157e2053a7355", + "value": " 535k/? [00:00<00:00, 13.7MB/s]" + } + }, + "e3ee2d8c59984b5db852a1b817f059ce": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "c091a4f8633d45a7b7b2edf586ea0061": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "596bc1fb1b894a1b85b5384334272fb3": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "1a46600352554561846be7952e8011ff": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "029fc3701fae42cb850a3e5f7f06fcab": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "e24605ca213a411c98c2a61a083b2a31": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "ba3330e94ef14ed4aed157e2053a7355": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + } + } + } + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "cellView": "form", + "id": "zuUJqH0fyfos" + }, + "outputs": [], + "source": [ + "# @title # 1. Penginstalan import library\n", + "\n", + "!pip install stanza pandas -q\n", + "\n", + "import stanza\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "source": [ + "# @title # 2. mengunduh model dan inisialisasi pipeline\n", + "\n", + "stanza.download('id')\n", + "\n", + "nlp = stanza.Pipeline('id', processors='tokenize,pos')\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 545, + "referenced_widgets": [ + "9b0359b5095147e984e073d823aeedf7", + "d692de17dcea4f5ab3e473493f3f5f32", + "c6bb8c98ae6741a69d9e13b2f7785e1c", + "6e40eba3b0c54023af9242c2c5e4b12a", + "2cae0b4992e5400bbf5a55780eb36494", + "75899e0d92dd4884952efba1f69650f4", + "6c4d77e529ea4b6bae159dca04aa2472", + "f3945a9bb1fa4422964689a14ff4835c", + "9f5084c569bc4a1192a360afbecd668c", + "9c02c910ce364b3da4dfb65b530bffcc", + "e397441ad19d4e9c8aa8a1396e342875", + "aaacf7f0ebfd4679be3f8f6f4dc7b927", + "1e8f4a3d737647bb8e0e4bf069cf600f", + "dcc428a4ef124e0e86f7889cebfa6de8", + "a9d17a8422f5496180adffb66f1e637b", + "e3ee2d8c59984b5db852a1b817f059ce", + "c091a4f8633d45a7b7b2edf586ea0061", + "596bc1fb1b894a1b85b5384334272fb3", + "1a46600352554561846be7952e8011ff", + "029fc3701fae42cb850a3e5f7f06fcab", + "e24605ca213a411c98c2a61a083b2a31", + "ba3330e94ef14ed4aed157e2053a7355" + ] + }, + "collapsed": true, + "cellView": "form", + "id": "QBUNBGbdzTp0", + "outputId": "49b3b8ef-3184-4482-ead8-668ab37f3c05" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "display_data", + "data": { + "text/plain": [ + "Downloading https://raw.githubusercontent.com/stanfordnlp/stanza-resources/main/resources_1.15.0.json: 0%| …" + ], + "application/vnd.jupyter.widget-view+json": { + "version_major": 2, + "version_minor": 0, + "model_id": "9b0359b5095147e984e073d823aeedf7" + } + }, + "metadata": {} + }, + { + "output_type": "stream", + "name": "stderr", + "text": [ + "INFO:stanza:Downloaded file to /root/.cache/stanza/1.15.0/resources/resources.json\n", + "INFO:stanza:Downloading default packages for language: id (Indonesian) ...\n", + "INFO:stanza:File exists: /root/.cache/stanza/1.15.0/resources/id/default.zip\n", + "INFO:stanza:Finished downloading models and saved to /root/.cache/stanza/1.15.0/resources\n", + "INFO:stanza:Checking for updates to resources.json in case models have been updated. Note: this behavior can be turned off with download_method=None or download_method=DownloadMethod.REUSE_RESOURCES\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "Downloading https://raw.githubusercontent.com/stanfordnlp/stanza-resources/main/resources_1.15.0.json: 0%| …" + ], + "application/vnd.jupyter.widget-view+json": { + "version_major": 2, + "version_minor": 0, + "model_id": "aaacf7f0ebfd4679be3f8f6f4dc7b927" + } + }, + "metadata": {} + }, + { + "output_type": "stream", + "name": "stderr", + "text": [ + "INFO:stanza:Downloaded file to /root/.cache/stanza/1.15.0/resources/resources.json\n", + "WARNING:stanza:Language id package default expects mwt, which has been added\n", + "INFO:stanza:Loading these models for language: id (Indonesian):\n", + "============================\n", + "| Processor | Package |\n", + "----------------------------\n", + "| tokenize | gsd_nocharlm |\n", + "| mwt | gsd |\n", + "| pos | gsd_charlm |\n", + "============================\n", + "\n", + "INFO:stanza:Using device: cpu\n", + "INFO:stanza:Loading: tokenize\n", + "INFO:stanza:Loading: mwt\n", + "INFO:stanza:Loading: pos\n", + "INFO:stanza:Done loading processors!\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# @title # 3. Menyediakan teks input\n", + "\n", + "teks_berita = \"\"\"Kucing tetangga saya belajar pemrograman selama tiga hari langsung diterima kerja di perusahaan teknologi.\n", + "Sementara itu, saya yang sudah mahasiswa tingkat akhir masih bingung membedakan antara error program dan error jalan hidup.\n", + "Dosen pembimbing berkata bahwa skripsi saya sangat unik, unik karena dari judul sampai kesimpulan tidak ada yang masuk akal\n", + "\"\"\"\n" + ], + "metadata": { + "cellView": "form", + "id": "7SMyOc9u2OJw" + }, + "execution_count": 14, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# @title # 4. Pemrosessan Teks model oleh NLP\n", + "\n", + "doc = nlp(teks_berita)" + ], + "metadata": { + "cellView": "form", + "id": "cQ3N1mII3qSn" + }, + "execution_count": 15, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# @title # 5. ekstraksi hasil ke dalam tabel (pandas)\n", + "\n", + "data_pos = []\n", + "\n", + "for sentence in doc.sentences:\n", + " for word in sentence.words:\n", + " data_pos.append({\n", + " \"Kata (Token)\": word.text,\n", + " \"Tag POS (UPOS)\": word.upos,\n", + " \"Penjelasan\": word.xpos\n", + " })" + ], + "metadata": { + "cellView": "form", + "id": "LXjTz7MY4FSi" + }, + "execution_count": 16, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# @title # 6. Menampilkan Hasil\n", + "\n", + "df = pd.DataFrame(data_pos)\n", + "print(\" HASIL POS TAGGING BAHASA INDONESIA \")\n", + "display(df)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 677 + }, + "cellView": "form", + "collapsed": true, + "id": "esgxNggp4tvq", + "outputId": "0782986d-1493-4625-e0cd-a92ec2e6a30b" + }, + "execution_count": 17, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + " HASIL POS TAGGING BAHASA INDONESIA \n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + " Kata (Token) Tag POS (UPOS) Penjelasan\n", + "0 Kucing PROPN NSD\n", + "1 tetangga NOUN NSD\n", + "2 saya PRON PS1\n", + "3 belajar VERB NSD\n", + "4 pemrograman NOUN NSD\n", + "5 selama ADP R--\n", + "6 tiga NUM CC-\n", + "7 hari NOUN NSD\n", + "8 langsung ADV D--\n", + "9 diterima VERB VSP\n", + "10 kerja NOUN NSD\n", + "11 di ADP R--\n", + "12 perusahaan NOUN NSD\n", + "13 teknologi NOUN NSD\n", + "14 . PUNCT Z--\n", + "15 Sementara SCONJ S--\n", + "16 itu PRON B--\n", + "17 , PUNCT Z--\n", + "18 saya PRON PS1\n", + "19 yang PRON S--\n", + "20 sudah AUX VSA\n", + "21 mahasiswa NOUN NSD\n", + "22 tingkat NOUN NSD\n", + "23 akhir ADJ NSD\n", + "24 masih ADV D--\n", + "25 bingung VERB ASP\n", + "26 membedakan VERB VSA\n", + "27 antara ADP R--\n", + "28 error NOUN F--\n", + "29 program NOUN NSD\n", + "30 dan CCONJ H--\n", + "31 error NOUN F--\n", + "32 jalan NOUN VSA\n", + "33 hidup ADJ NSD\n", + "34 . PUNCT Z--\n", + "35 Dosen PROPN NSD\n", + "36 pembimbing NOUN NSD\n", + "37 berkata VERB VSA\n", + "38 bahwa SCONJ S--\n", + "39 skripsi NOUN NSD\n", + "40 saya PRON PS1\n", + "41 sangat ADV D--\n", + "42 unik ADJ ASP\n", + "43 , PUNCT Z--\n", + "44 unik ADJ ASP\n", + "45 karena SCONJ S--\n", + "46 dari ADP R--\n", + "47 judul NOUN NSD\n", + "48 sampai ADP R--\n", + "49 kesimpulan NOUN NSD\n", + "50 tidak PART G--\n", + "51 ada VERB ASP\n", + "52 yang PRON S--\n", + "53 masuk VERB VSA\n", + "54 akal ADJ NSD" + ], + "text/html": [ + "\n", + "
| \n", + " | Kata (Token) | \n", + "Tag POS (UPOS) | \n", + "Penjelasan | \n", + "
|---|---|---|---|
| 0 | \n", + "Kucing | \n", + "PROPN | \n", + "NSD | \n", + "
| 1 | \n", + "tetangga | \n", + "NOUN | \n", + "NSD | \n", + "
| 2 | \n", + "saya | \n", + "PRON | \n", + "PS1 | \n", + "
| 3 | \n", + "belajar | \n", + "VERB | \n", + "NSD | \n", + "
| 4 | \n", + "pemrograman | \n", + "NOUN | \n", + "NSD | \n", + "
| 5 | \n", + "selama | \n", + "ADP | \n", + "R-- | \n", + "
| 6 | \n", + "tiga | \n", + "NUM | \n", + "CC- | \n", + "
| 7 | \n", + "hari | \n", + "NOUN | \n", + "NSD | \n", + "
| 8 | \n", + "langsung | \n", + "ADV | \n", + "D-- | \n", + "
| 9 | \n", + "diterima | \n", + "VERB | \n", + "VSP | \n", + "
| 10 | \n", + "kerja | \n", + "NOUN | \n", + "NSD | \n", + "
| 11 | \n", + "di | \n", + "ADP | \n", + "R-- | \n", + "
| 12 | \n", + "perusahaan | \n", + "NOUN | \n", + "NSD | \n", + "
| 13 | \n", + "teknologi | \n", + "NOUN | \n", + "NSD | \n", + "
| 14 | \n", + ". | \n", + "PUNCT | \n", + "Z-- | \n", + "
| 15 | \n", + "Sementara | \n", + "SCONJ | \n", + "S-- | \n", + "
| 16 | \n", + "itu | \n", + "PRON | \n", + "B-- | \n", + "
| 17 | \n", + ", | \n", + "PUNCT | \n", + "Z-- | \n", + "
| 18 | \n", + "saya | \n", + "PRON | \n", + "PS1 | \n", + "
| 19 | \n", + "yang | \n", + "PRON | \n", + "S-- | \n", + "
| 20 | \n", + "sudah | \n", + "AUX | \n", + "VSA | \n", + "
| 21 | \n", + "mahasiswa | \n", + "NOUN | \n", + "NSD | \n", + "
| 22 | \n", + "tingkat | \n", + "NOUN | \n", + "NSD | \n", + "
| 23 | \n", + "akhir | \n", + "ADJ | \n", + "NSD | \n", + "
| 24 | \n", + "masih | \n", + "ADV | \n", + "D-- | \n", + "
| 25 | \n", + "bingung | \n", + "VERB | \n", + "ASP | \n", + "
| 26 | \n", + "membedakan | \n", + "VERB | \n", + "VSA | \n", + "
| 27 | \n", + "antara | \n", + "ADP | \n", + "R-- | \n", + "
| 28 | \n", + "error | \n", + "NOUN | \n", + "F-- | \n", + "
| 29 | \n", + "program | \n", + "NOUN | \n", + "NSD | \n", + "
| 30 | \n", + "dan | \n", + "CCONJ | \n", + "H-- | \n", + "
| 31 | \n", + "error | \n", + "NOUN | \n", + "F-- | \n", + "
| 32 | \n", + "jalan | \n", + "NOUN | \n", + "VSA | \n", + "
| 33 | \n", + "hidup | \n", + "ADJ | \n", + "NSD | \n", + "
| 34 | \n", + ". | \n", + "PUNCT | \n", + "Z-- | \n", + "
| 35 | \n", + "Dosen | \n", + "PROPN | \n", + "NSD | \n", + "
| 36 | \n", + "pembimbing | \n", + "NOUN | \n", + "NSD | \n", + "
| 37 | \n", + "berkata | \n", + "VERB | \n", + "VSA | \n", + "
| 38 | \n", + "bahwa | \n", + "SCONJ | \n", + "S-- | \n", + "
| 39 | \n", + "skripsi | \n", + "NOUN | \n", + "NSD | \n", + "
| 40 | \n", + "saya | \n", + "PRON | \n", + "PS1 | \n", + "
| 41 | \n", + "sangat | \n", + "ADV | \n", + "D-- | \n", + "
| 42 | \n", + "unik | \n", + "ADJ | \n", + "ASP | \n", + "
| 43 | \n", + ", | \n", + "PUNCT | \n", + "Z-- | \n", + "
| 44 | \n", + "unik | \n", + "ADJ | \n", + "ASP | \n", + "
| 45 | \n", + "karena | \n", + "SCONJ | \n", + "S-- | \n", + "
| 46 | \n", + "dari | \n", + "ADP | \n", + "R-- | \n", + "
| 47 | \n", + "judul | \n", + "NOUN | \n", + "NSD | \n", + "
| 48 | \n", + "sampai | \n", + "ADP | \n", + "R-- | \n", + "
| 49 | \n", + "kesimpulan | \n", + "NOUN | \n", + "NSD | \n", + "
| 50 | \n", + "tidak | \n", + "PART | \n", + "G-- | \n", + "
| 51 | \n", + "ada | \n", + "VERB | \n", + "ASP | \n", + "
| 52 | \n", + "yang | \n", + "PRON | \n", + "S-- | \n", + "
| 53 | \n", + "masuk | \n", + "VERB | \n", + "VSA | \n", + "
| 54 | \n", + "akal | \n", + "ADJ | \n", + "NSD | \n", + "