From 96d779fc15e5f0628f76a2d47e9774057197cb97 Mon Sep 17 00:00:00 2001 From: parinayc20 Date: Fri, 16 Jul 2021 14:29:25 +0530 Subject: [PATCH 1/6] Final model added --- Final model/Team_5.ipynb | 1 + 1 file changed, 1 insertion(+) create mode 100644 Final model/Team_5.ipynb diff --git a/Final model/Team_5.ipynb b/Final model/Team_5.ipynb new file mode 100644 index 0000000..4747a0e --- /dev/null +++ b/Final model/Team_5.ipynb @@ -0,0 +1 @@ +{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd \nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n for filename in filenames:\n print(os.path.join(dirname, filename))","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-06-20T11:35:19.37795Z","iopub.execute_input":"2021-06-20T11:35:19.378669Z","iopub.status.idle":"2021-06-20T11:35:19.417007Z","shell.execute_reply.started":"2021-06-20T11:35:19.378546Z","shell.execute_reply":"2021-06-20T11:35:19.416284Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from keras.models import Model\nimport tensorflow as tf\nimport pandas as pd \nfrom keras.layers import Input, LSTM, GRU, Dense, Embedding\nfrom keras.preprocessing.text import Tokenizer\nfrom keras.preprocessing.sequence import pad_sequences\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport re\nimport pickle","metadata":{"execution":{"iopub.status.busy":"2021-06-20T11:35:19.418096Z","iopub.execute_input":"2021-06-20T11:35:19.418529Z","iopub.status.idle":"2021-06-20T11:35:25.139851Z","shell.execute_reply.started":"2021-06-20T11:35:19.418492Z","shell.execute_reply":"2021-06-20T11:35:25.138931Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nor_train=open(\"/kaggle/input/test-dataset/normal.training.txt\",\"r\")\nsim_train=open(\"/kaggle/input/test-dataset/simple.training.txt\",\"r\")\nnormal_train=nor_train.readlines()\nsimple_train=sim_train.readlines()","metadata":{"execution":{"iopub.status.busy":"2021-06-20T11:35:25.143643Z","iopub.execute_input":"2021-06-20T11:35:25.143927Z","iopub.status.idle":"2021-06-20T11:35:25.809056Z","shell.execute_reply.started":"2021-06-20T11:35:25.143901Z","shell.execute_reply":"2021-06-20T11:35:25.808335Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def preprocess_sentence(w):\n w = re.sub(r\"([?.!,¿])\", r\" \\1 \", w)\n w = re.sub(r'[\" \"]+', \" \", w)\n w = re.sub(r\"[^a-zA-Z?.!,¿]+\", \" \", w)\n w = w.strip()\n w = 'sssss ' + w + ' eeeee'\n return w","metadata":{"execution":{"iopub.status.busy":"2021-06-20T11:35:25.810655Z","iopub.execute_input":"2021-06-20T11:35:25.811247Z","iopub.status.idle":"2021-06-20T11:35:25.817257Z","shell.execute_reply.started":"2021-06-20T11:35:25.811205Z","shell.execute_reply":"2021-06-20T11:35:25.816321Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"BATCH_SIZE = 1000\nEPOCHS = 64\nNUM_SENTENCES = 1000\nMAX_SENTENCE_LENGTH = 1200\nMAX_NUM_WORDS = 4000\nEMBEDDING_SIZE = 100","metadata":{"execution":{"iopub.status.busy":"2021-06-20T11:35:25.818643Z","iopub.execute_input":"2021-06-20T11:35:25.819037Z","iopub.status.idle":"2021-06-20T11:35:25.829984Z","shell.execute_reply.started":"2021-06-20T11:35:25.818998Z","shell.execute_reply":"2021-06-20T11:35:25.829058Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"input_sentences = []\noutput_sentences = []\noutput_sentences_inputs = []\ni=0\nk=0\nwhile i <(NUM_SENTENCES):\n try:\n s1=normal_train[k]\n except:\n print(k)\n break\n if(len(s1)