{"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 os\nimport tarfile\nimport requests\nimport urllib.request","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:52.354167Z","iopub.execute_input":"2022-10-12T02:17:52.355267Z","iopub.status.idle":"2022-10-12T02:17:52.39469Z","shell.execute_reply.started":"2022-10-12T02:17:52.355143Z","shell.execute_reply":"2022-10-12T02:17:52.393337Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ff93c5464d8a43a080d53ac0c372ed97\n#df68e7a930e5410ea8c5d1ceb8608d6d","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:52.397211Z","iopub.execute_input":"2022-10-12T02:17:52.3977Z","iopub.status.idle":"2022-10-12T02:17:52.40291Z","shell.execute_reply.started":"2022-10-12T02:17:52.397656Z","shell.execute_reply":"2022-10-12T02:17:52.401593Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#japaneast\n#ff93c5464d8a43a080d53ac0c372ed97\n#https://isop.cognitiveservices.azure.com/","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:52.404607Z","iopub.execute_input":"2022-10-12T02:17:52.404946Z","iopub.status.idle":"2022-10-12T02:17:52.416476Z","shell.execute_reply.started":"2022-10-12T02:17:52.404916Z","shell.execute_reply":"2022-10-12T02:17:52.4153Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def make_tarfile(output_filename, source_dir):\n    with tarfile.open(output_filename, \"w:gz\") as tar:\n        tar.add(source_dir, arcname=os.path.basename(source_dir))","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:52.419536Z","iopub.execute_input":"2022-10-12T02:17:52.419936Z","iopub.status.idle":"2022-10-12T02:17:52.430301Z","shell.execute_reply.started":"2022-10-12T02:17:52.419903Z","shell.execute_reply":"2022-10-12T02:17:52.42907Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.mkdir(\"/kaggle/working/python-Levenshtein\")","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:24:34.333411Z","iopub.execute_input":"2022-10-12T02:24:34.333934Z","iopub.status.idle":"2022-10-12T02:24:34.340231Z","shell.execute_reply.started":"2022-10-12T02:24:34.333897Z","shell.execute_reply":"2022-10-12T02:24:34.339073Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip download python-Levenshtein -d \"/kaggle/working/python-Levenshtein/\"\n#url=\"https://javadl.oracle.com/webapps/download/AutoDL?BundleId=246805_424b9da4b48848379167015dcc250d8d\"\n#urllib.request.urlretrieve(url, \"/kaggle/working/vim/vim.exe\")","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:24:39.042381Z","iopub.execute_input":"2022-10-12T02:24:39.042829Z","iopub.status.idle":"2022-10-12T02:24:43.844545Z","shell.execute_reply.started":"2022-10-12T02:24:39.042785Z","shell.execute_reply":"2022-10-12T02:24:43.842968Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"os.listdir(\"/kaggle/working/python-Levenshtein\")","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:25:02.345026Z","iopub.execute_input":"2022-10-12T02:25:02.345435Z","iopub.status.idle":"2022-10-12T02:25:02.353795Z","shell.execute_reply.started":"2022-10-12T02:25:02.345396Z","shell.execute_reply":"2022-10-12T02:25:02.352395Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#make_tarfile(\"vimfile\", \"/kaggle/working/vim/vim.exe\")","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:58.975248Z","iopub.execute_input":"2022-10-12T02:17:58.975784Z","iopub.status.idle":"2022-10-12T02:17:58.982488Z","shell.execute_reply.started":"2022-10-12T02:17:58.975731Z","shell.execute_reply":"2022-10-12T02:17:58.980828Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#os.listdir('/kaggle/working/')","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:58.984183Z","iopub.execute_input":"2022-10-12T02:17:58.985088Z","iopub.status.idle":"2022-10-12T02:17:58.994534Z","shell.execute_reply.started":"2022-10-12T02:17:58.985037Z","shell.execute_reply":"2022-10-12T02:17:58.993637Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#!apt install zip","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:58.99548Z","iopub.execute_input":"2022-10-12T02:17:58.996156Z","iopub.status.idle":"2022-10-12T02:17:59.008117Z","shell.execute_reply.started":"2022-10-12T02:17:58.996119Z","shell.execute_reply":"2022-10-12T02:17:59.006873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#cd /kaggle/working/windows_terminal/","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:59.012017Z","iopub.execute_input":"2022-10-12T02:17:59.012402Z","iopub.status.idle":"2022-10-12T02:17:59.021491Z","shell.execute_reply.started":"2022-10-12T02:17:59.012369Z","shell.execute_reply":"2022-10-12T02:17:59.020257Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#!zip -r -m -1 -q /kaggle/working/windows_terminal.zip *","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:59.023377Z","iopub.execute_input":"2022-10-12T02:17:59.023864Z","iopub.status.idle":"2022-10-12T02:17:59.034814Z","shell.execute_reply.started":"2022-10-12T02:17:59.023819Z","shell.execute_reply":"2022-10-12T02:17:59.033771Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import requests\n\ndef download_file_from_google_drive(id, destination):\n    URL = \"https://docs.google.com/uc?export=download\"\n\n    session = requests.Session()\n\n    response = session.get(URL, params = { 'id' : id }, stream = True)\n    token = get_confirm_token(response)\n\n    if token:\n        params = { 'id' : id, 'confirm' : token }\n        response = session.get(URL, params = params, stream = True)\n\n    save_response_content(response, destination)    \n\ndef get_confirm_token(response):\n    for key, value in response.cookies.items():\n        if key.startswith('download_warning'):\n            return value\n\n    return None\n\ndef save_response_content(response, destination):\n    CHUNK_SIZE = 32768\n\n    with open(destination, \"wb\") as f:\n        for chunk in response.iter_content(CHUNK_SIZE):\n            if chunk: # filter out keep-alive new chunks\n                f.write(chunk)\n\n#if __name__ == \"__main__\":\n#    file_id = '1lqd-k8FS8rAQD6EyESyRxyjsQpw8h2w5'\n#    destination = '/kaggle/working/w2v_jieba.model'\n#    download_file_from_google_drive(file_id, destination)","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:59.036769Z","iopub.execute_input":"2022-10-12T02:17:59.03722Z","iopub.status.idle":"2022-10-12T02:17:59.04921Z","shell.execute_reply.started":"2022-10-12T02:17:59.037181Z","shell.execute_reply":"2022-10-12T02:17:59.048089Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#import os\n#os.listdir(\"/kaggle/working/\")","metadata":{"execution":{"iopub.status.busy":"2022-10-12T02:17:59.051002Z","iopub.execute_input":"2022-10-12T02:17:59.051438Z","iopub.status.idle":"2022-10-12T02:17:59.063158Z","shell.execute_reply.started":"2022-10-12T02:17:59.051403Z","shell.execute_reply":"2022-10-12T02:17:59.061686Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}