{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":59575,"databundleVersionId":8060720,"sourceType":"competition"},{"sourceId":7731449,"sourceType":"datasetVersion","datasetId":4517815},{"sourceId":174185912,"sourceType":"kernelVersion"}],"dockerImageVersionId":30664,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"debug code of https://www.kaggle.com/competitions/uspto-explainable-ai/discussion/498283","metadata":{}},{"cell_type":"code","source":"import whoosh_utils\n","metadata":{"execution":{"iopub.status.busy":"2024-04-28T03:57:43.374974Z","iopub.execute_input":"2024-04-28T03:57:43.375420Z","iopub.status.idle":"2024-04-28T03:58:16.844821Z","shell.execute_reply.started":"2024-04-28T03:57:43.375386Z","shell.execute_reply":"2024-04-28T03:58:16.843813Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%bash\ncat << EOS > whoosh3.patch\n1039a1040,1041\n>         tolerance = 1e-10\n> \n1042c1044\n<         if block_quality() > minquality:\n---\n>         if block_quality() > minquality + tolerance:\n1047c1049\n<         return self._skip_to_block(lambda: block_quality() <= minquality)\n---\n>         return self._skip_to_block(lambda: block_quality() <= minquality + tolerance)\nEOS\n\npatch /opt/conda/lib/python3.10/site-packages/whoosh/codec/whoosh3.py whoosh3.patch","metadata":{"execution":{"iopub.status.busy":"2024-04-28T03:58:22.756001Z","iopub.execute_input":"2024-04-28T03:58:22.756414Z","iopub.status.idle":"2024-04-28T03:58:22.786684Z","shell.execute_reply.started":"2024-04-28T03:58:22.756378Z","shell.execute_reply":"2024-04-28T03:58:22.785848Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import importlib\nimport whoosh\nimportlib.reload(whoosh)\n\ntrain_idx = whoosh_utils.load_index('/kaggle/input/uspto-explainable-ai/train_index')\nsearcher = whoosh_utils.get_searcher(train_idx)\nqp = whoosh_utils.get_query_parser()","metadata":{"execution":{"iopub.status.busy":"2024-04-28T03:58:26.087877Z","iopub.execute_input":"2024-04-28T03:58:26.088274Z","iopub.status.idle":"2024-04-28T03:59:32.607060Z","shell.execute_reply.started":"2024-04-28T03:58:26.088245Z","shell.execute_reply":"2024-04-28T03:59:32.605797Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"query_3 = 'cpc:G03G15/224 OR cpc:B33Y10/00 OR cpc:B33Y30/00'\nwhoosh_utils.execute_query(query_3, qp, searcher) # this line not works and causes freezing","metadata":{"execution":{"iopub.status.busy":"2024-04-28T03:59:36.939430Z","iopub.execute_input":"2024-04-28T03:59:36.939830Z","iopub.status.idle":"2024-04-28T03:59:37.046529Z","shell.execute_reply.started":"2024-04-28T03:59:36.939801Z","shell.execute_reply":"2024-04-28T03:59:37.045343Z"},"trusted":true},"execution_count":null,"outputs":[]}]}