{"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":166738328,"sourceType":"kernelVersion"}],"dockerImageVersionId":30698,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"Published on April 26, 2024. By Marília Prata, mpwolke","metadata":{}},{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\nimport plotly.graph_objs as go\nimport plotly.offline as py\nimport plotly.express as px\n\n#Ignore warnings\nimport warnings\nwarnings.filterwarnings('ignore')\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-04-27T00:05:48.387676Z","iopub.execute_input":"2024-04-27T00:05:48.388144Z","iopub.status.idle":"2024-04-27T00:05:49.369552Z","shell.execute_reply.started":"2024-04-27T00:05:48.388111Z","shell.execute_reply":"2024-04-27T00:05:49.368285Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#A Non-Whoosh and a Whoosh search for my \"Whooshy\" code collection.\n\nSince my 1st Whoosh search code when I wasn't able to deliver any search, I felt frustrated. Then, I decided to try this 2nd \"Whooshy\" K-Notebook : )   ","metadata":{}},{"cell_type":"code","source":"df = pd.read_parquet(\"/kaggle/input/uspto-explainable-ai/patent_data/2013_12.parquet\")\ndf.tail(3)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:06:11.119674Z","iopub.execute_input":"2024-04-27T00:06:11.120127Z","iopub.status.idle":"2024-04-27T00:06:25.518890Z","shell.execute_reply.started":"2024-04-27T00:06:11.120094Z","shell.execute_reply":"2024-04-27T00:06:25.517669Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#By Salman Chen https://www.kaggle.com/salmanhiro/covids-incubation-transmission-related-articles/comments\n\ntitle = df.copy()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:06:31.577891Z","iopub.execute_input":"2024-04-27T00:06:31.578294Z","iopub.status.idle":"2024-04-27T00:06:31.589936Z","shell.execute_reply.started":"2024-04-27T00:06:31.578265Z","shell.execute_reply":"2024-04-27T00:06:31.588427Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#By Salman Chen https://www.kaggle.com/salmanhiro/covids-incubation-transmission-related-articles/comments\n\ntitle = title.dropna(subset=['title'])","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:06:37.638286Z","iopub.execute_input":"2024-04-27T00:06:37.638733Z","iopub.status.idle":"2024-04-27T00:06:37.665529Z","shell.execute_reply.started":"2024-04-27T00:06:37.638702Z","shell.execute_reply":"2024-04-27T00:06:37.664270Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"title.tail(50)","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-04-26T23:44:03.471789Z","iopub.execute_input":"2024-04-26T23:44:03.472883Z","iopub.status.idle":"2024-04-26T23:44:03.519620Z","shell.execute_reply.started":"2024-04-26T23:44:03.472848Z","shell.execute_reply":"2024-04-26T23:44:03.518546Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#By Salman Chen https://www.kaggle.com/salmanhiro/covids-incubation-transmission-related-articles/comments\n\ntitle['title'] = title['title'].str.replace('[^a-zA-Z]', ' ', regex=True)\ntitle['title'] = title['title'].str.lower()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:06:44.427992Z","iopub.execute_input":"2024-04-27T00:06:44.428424Z","iopub.status.idle":"2024-04-27T00:06:44.597822Z","shell.execute_reply.started":"2024-04-27T00:06:44.428395Z","shell.execute_reply":"2024-04-27T00:06:44.596377Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Searching by cryptographic (on titles)","metadata":{"execution":{"iopub.status.busy":"2024-04-26T17:08:32.934787Z","iopub.execute_input":"2024-04-26T17:08:32.935232Z","iopub.status.idle":"2024-04-26T17:08:32.944217Z","shell.execute_reply.started":"2024-04-26T17:08:32.935202Z","shell.execute_reply":"2024-04-26T17:08:32.943021Z"}}},{"cell_type":"code","source":"#By Salman Chen https://www.kaggle.com/salmanhiro/covids-incubation-transmission-related-articles/comments\n\ntitle['keyword_cryptographic'] = title['title'].str.find('cryptographic') ","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:06:50.825017Z","iopub.execute_input":"2024-04-27T00:06:50.825413Z","iopub.status.idle":"2024-04-27T00:06:50.867744Z","shell.execute_reply.started":"2024-04-27T00:06:50.825384Z","shell.execute_reply":"2024-04-27T00:06:50.866187Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#If the result prompt -1, then the title doesn't contained the keyword.","metadata":{}},{"cell_type":"code","source":"title.head(3)","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-04-26T23:44:31.561105Z","iopub.execute_input":"2024-04-26T23:44:31.561625Z","iopub.status.idle":"2024-04-26T23:44:31.582880Z","shell.execute_reply.started":"2024-04-26T23:44:31.561583Z","shell.execute_reply":"2024-04-26T23:44:31.581772Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Cryptographic (11)Patents found on 2013.","metadata":{}},{"cell_type":"code","source":"#By Salman Chen https://www.kaggle.com/salmanhiro/covids-incubation-transmission-related-articles/comments\n\nincluded_cryptographic = title.loc[title['keyword_cryptographic'] != -1]\nincluded_cryptographic","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:07:01.185063Z","iopub.execute_input":"2024-04-27T00:07:01.185472Z","iopub.status.idle":"2024-04-27T00:07:01.210768Z","shell.execute_reply.started":"2024-04-27T00:07:01.185443Z","shell.execute_reply":"2024-04-27T00:07:01.209591Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Searching Orthodontic Patents","metadata":{}},{"cell_type":"code","source":"#By Salman Chen https://www.kaggle.com/salmanhiro/covids-incubation-transmission-related-articles/comments\n\ntitle['keyword_orthodontic'] = title['title'].str.find('orthodontic')","metadata":{"execution":{"iopub.status.busy":"2024-04-26T23:44:46.184094Z","iopub.execute_input":"2024-04-26T23:44:46.184562Z","iopub.status.idle":"2024-04-26T23:44:46.222034Z","shell.execute_reply.started":"2024-04-26T23:44:46.184528Z","shell.execute_reply":"2024-04-26T23:44:46.220689Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Done. We found the Orthodontics Patents on the year 2013.","metadata":{}},{"cell_type":"code","source":"included_orthodontic = title.loc[title['keyword_orthodontic'] != -1]\nincluded_orthodontic","metadata":{"execution":{"iopub.status.busy":"2024-04-26T23:44:51.856177Z","iopub.execute_input":"2024-04-26T23:44:51.856594Z","iopub.status.idle":"2024-04-26T23:44:51.876280Z","shell.execute_reply.started":"2024-04-26T23:44:51.856562Z","shell.execute_reply":"2024-04-26T23:44:51.875261Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Add input: Whoosh utils and whoosh_wheel_2_7_4\n\nhttps://www.kaggle.com/code/metric/whoosh-utils\n\nhttps://www.kaggle.com/datasets/metric/whoosh-wheel-2-7-4/code","metadata":{}},{"cell_type":"code","source":"#By Sohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook\n\nimport whoosh_utils","metadata":{"execution":{"iopub.status.busy":"2024-04-26T23:41:00.304450Z","iopub.execute_input":"2024-04-26T23:41:00.304863Z","iopub.status.idle":"2024-04-26T23:41:15.390462Z","shell.execute_reply.started":"2024-04-26T23:41:00.304834Z","shell.execute_reply":"2024-04-26T23:41:15.389322Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#By Sohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook\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-26T23:41:47.133304Z","iopub.execute_input":"2024-04-26T23:41:47.133985Z","iopub.status.idle":"2024-04-26T23:42:45.068958Z","shell.execute_reply.started":"2024-04-26T23:41:47.133940Z","shell.execute_reply":"2024-04-26T23:42:45.067926Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#By SeshuRajup https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-whoosh-utils-eda/notebook\n\npatent_details = pd.read_parquet(\"/kaggle/input/uspto-explainable-ai/patent_data/2013_12.parquet\")","metadata":{"execution":{"iopub.status.busy":"2024-04-26T23:47:37.498136Z","iopub.execute_input":"2024-04-26T23:47:37.498618Z","iopub.status.idle":"2024-04-26T23:47:49.122230Z","shell.execute_reply.started":"2024-04-26T23:47:37.498584Z","shell.execute_reply":"2024-04-26T23:47:49.121174Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#By SeshuRajup https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-whoosh-utils-eda/notebook\n\nimport re\nimport whoosh\n\nNUMBER_REGEX = re.compile(r'^(\\d+|\\d{1,3}(,\\d{3})*)(\\.\\d+)?$')\n\nclass NumberFilter(whoosh.analysis.Filter):\n    def __call__(self, tokens):\n        for t in tokens:\n            if not NUMBER_REGEX.match(t.text):\n                yield t\n                \nBRS_STOPWORDS = ['an', 'are', 'by', 'for', 'if', 'into', 'is', 'no', 'not', 'of', 'on', 'such',\n        'that', 'the', 'their', 'then', 'there', 'these', 'they', 'this', 'to', 'was', 'will']\ntext_analyzer = whoosh.analysis.StandardAnalyzer(stoplist=BRS_STOPWORDS) | NumberFilter()","metadata":{"execution":{"iopub.status.busy":"2024-04-26T23:49:23.653232Z","iopub.execute_input":"2024-04-26T23:49:23.653727Z","iopub.status.idle":"2024-04-26T23:49:23.665061Z","shell.execute_reply.started":"2024-04-26T23:49:23.653693Z","shell.execute_reply":"2024-04-26T23:49:23.661833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Orthodontics Patents on 2013\n\nSince Description and Claims are too long, I commented these lines.\n\nSnippet by SeshuRajup https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-whoosh-utils-eda/notebook","metadata":{}},{"cell_type":"code","source":"#By SeshuRajup https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-whoosh-utils-eda/notebook\n\nfrom IPython.core.display import display, HTML\ndef parse_data(section, text):\n    display(HTML(f\"<b style='color:blue'>{section.title()}</b>: <span style='color:blue'>{text}<span>\"))\n    tokens = text_analyzer(text)\n    display(HTML(f\"<b style='color:green'>{section.title()} Tokens</b>: <span style='color:green'>{str([token.text for token in tokens])}</span>\"))\n    \nfor i in range(len(patent_details['publication_number'])):\n    if i > 2:\n        break\n    \n    pubnum = patent_details['publication_number'][1284]\n    title = patent_details['title'][1284]\n    abstract = patent_details['abstract'][1284]\n    #claims = patent_details['claims'][1284]\n    #description = patent_details['description'][1284]\n    display(HTML(f\"<br/>Publication number: <b style='color:red'>{pubnum}</b>\"))\n    parse_data('title', title)\n    parse_data('abstract', abstract)\n    #parse_data('claims', claims)\n    #parse_data('description', description)","metadata":{"execution":{"iopub.status.busy":"2024-04-26T23:57:38.253028Z","iopub.execute_input":"2024-04-26T23:57:38.253523Z","iopub.status.idle":"2024-04-26T23:57:38.292830Z","shell.execute_reply.started":"2024-04-26T23:57:38.253489Z","shell.execute_reply":"2024-04-26T23:57:38.291570Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#On This Day – 9th March 1822 - Charles M. Graham of N.Y. was issued the first U.S. patent for artificial teeth.\n\n![](https://www.mycirclecare.com/wp-content/uploads/2018/03/9-march-Charles-M-Graham-patent-artificial-teeth.jpg)https://www.mycirclecare.com/day-9th-march-1822/","metadata":{}},{"cell_type":"markdown","source":"#A simple query by Orthodontic and Cryptographic \n\nSince, below, I got 2022 (US-2022168071-A1) and 2018 (US-2018206941-A1) it's NO longer just the result from the Year:2013, 2013_parquet) \n\nAnyway, cause I found on 2013 2 for Orthodontics and 11 for cryptographic. Let's keep my lucky number: 13 Patents (total) on 2013 (year). Though the Whoosh search brought all the Patents, not only the ones made on 2013.","metadata":{}},{"cell_type":"code","source":"#By Sohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook\n\nquery = 'ti:orthodontic OR ti:cryptographic'\nresult = whoosh_utils.execute_query(query, qp, searcher)[:13]\nresult\n\n#whoosh_utils.execute_query(query, qp, searcher)[:13]","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:16:50.908401Z","iopub.execute_input":"2024-04-27T00:16:50.908941Z","iopub.status.idle":"2024-04-27T00:16:51.052537Z","shell.execute_reply.started":"2024-04-27T00:16:50.908905Z","shell.execute_reply":"2024-04-27T00:16:51.051557Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Cryptographic (3)Patents on 2013 year.\n\nBy SeshuRajup https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-whoosh-utils-eda/notebook","metadata":{}},{"cell_type":"code","source":"#By SeshuRajup https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-whoosh-utils-eda/notebook\n\nfor i in range(len(patent_details['publication_number'])):\n    if i > 2:\n        break\n    \n    pubnum = patent_details['publication_number'][1295]\n    title = patent_details['title'][1295]\n    abstract = patent_details['abstract'][1295]\n    #claims = patent_details['claims'][1295]\n    #description = patent_details['description'][1295]\n    display(HTML(f\"<br/>Publication number: <b style='color:red'>{pubnum}</b>\"))\n    parse_data('title', title)\n    parse_data('abstract', abstract)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:08:13.116920Z","iopub.execute_input":"2024-04-27T00:08:13.117358Z","iopub.status.idle":"2024-04-27T00:08:13.157042Z","shell.execute_reply.started":"2024-04-27T00:08:13.117328Z","shell.execute_reply":"2024-04-27T00:08:13.155975Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Whoosh Search\n\n\"train_index A Whoosh text search index equivalent in size and setup to the index the metric will use to evaluate submitted queries. Only includes patents published on or after 1975. The subset of patents covered by the actual metric index will not be disclosed even to your submission notebook. The following fields are searchable:\"\n\nti: title.\n\nab: abstract.\n\nclm: claims.\n\ndetd: description.\n\ncpc: cpc codes.\n\nhttps://www.kaggle.com/competitions/uspto-explainable-ai/data\n\nNo matter how you search (i.e. by ti, ab, clm) the result will be the respective publication_number.","metadata":{}},{"cell_type":"markdown","source":"#Verify how a query will be parsed. What's ADJ5? Adjacency 5 What?","metadata":{}},{"cell_type":"code","source":"#By Sohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook\n\n# This works as intended\nquery = 'ti:orthodontic ADJ5 cryptographic'\nqp.parse(query)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:17:38.973208Z","iopub.execute_input":"2024-04-27T00:17:38.973670Z","iopub.status.idle":"2024-04-27T00:17:38.981461Z","shell.execute_reply.started":"2024-04-27T00:17:38.973629Z","shell.execute_reply":"2024-04-27T00:17:38.980589Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Ti is title and ADJ is adjacency","metadata":{}},{"cell_type":"code","source":"#By Sohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook\n\n# Specifying the field separately for each term does not\nquery = 'ti:orthodontic ADJ5 ti:cryptographic'\nqp.parse(query)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:17:44.432390Z","iopub.execute_input":"2024-04-27T00:17:44.432843Z","iopub.status.idle":"2024-04-27T00:17:44.441531Z","shell.execute_reply.started":"2024-04-27T00:17:44.432809Z","shell.execute_reply":"2024-04-27T00:17:44.440242Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Adjacency","metadata":{}},{"cell_type":"code","source":"#By Sohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook\n\n# Setting the adjacency value too high breaks the operator\nquery = 'ti:orthodontic ADJ1234 cryptographic'\nqp.parse(query)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:17:48.849788Z","iopub.execute_input":"2024-04-27T00:17:48.850231Z","iopub.status.idle":"2024-04-27T00:17:48.859219Z","shell.execute_reply.started":"2024-04-27T00:17:48.850198Z","shell.execute_reply":"2024-04-27T00:17:48.858039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#By Sohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook\n\n# Basic wildcards work as expected\nquery = 'ti:or* OR ti:cr'\nqp.parse(query)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:17:53.412922Z","iopub.execute_input":"2024-04-27T00:17:53.413387Z","iopub.status.idle":"2024-04-27T00:17:53.422134Z","shell.execute_reply.started":"2024-04-27T00:17:53.413346Z","shell.execute_reply":"2024-04-27T00:17:53.420926Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#By Sohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook\n\n# Wildcards don't work in combination with adjacency operators: near gets parsed as a string literal.\n# The query will generate results, but not as expected.\nquery = 'ti:or* NEAR cryptographic'\nqp.parse(query)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:17:58.017715Z","iopub.execute_input":"2024-04-27T00:17:58.018689Z","iopub.status.idle":"2024-04-27T00:17:58.027122Z","shell.execute_reply.started":"2024-04-27T00:17:58.018647Z","shell.execute_reply":"2024-04-27T00:17:58.025958Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Since I want the CPC codes, read metadata parquet","metadata":{}},{"cell_type":"code","source":"meta = pd.read_parquet(\"/kaggle/input/uspto-explainable-ai/patent_metadata.parquet\")\nmeta.head()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:18:02.895719Z","iopub.execute_input":"2024-04-27T00:18:02.896824Z","iopub.status.idle":"2024-04-27T00:18:34.961672Z","shell.execute_reply.started":"2024-04-27T00:18:02.896788Z","shell.execute_reply":"2024-04-27T00:18:34.960830Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Orthodontic's Patent CPC","metadata":{}},{"cell_type":"code","source":"ortho = meta[(meta['publication_number']=='US-RE44668-E')].reset_index(drop=True)\northo.head()","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:19:01.515321Z","iopub.execute_input":"2024-04-27T00:19:01.515821Z","iopub.status.idle":"2024-04-27T00:19:04.087438Z","shell.execute_reply.started":"2024-04-27T00:19:01.515785Z","shell.execute_reply":"2024-04-27T00:19:04.086201Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"\"Be warned that the query parser isn't perfectly accurate. In this case it fails to warn that proximity operators won't work on the CPC field.\"","metadata":{}},{"cell_type":"code","source":"#By Sohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook\n\n#Below are Orthodontic cpc_codes\n\nquery = 'cpc:A61C7/20 NEAR cpc:B21F43/00'\nqp.parse(query)","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:19:17.510426Z","iopub.execute_input":"2024-04-27T00:19:17.511231Z","iopub.status.idle":"2024-04-27T00:19:17.520060Z","shell.execute_reply.started":"2024-04-27T00:19:17.511069Z","shell.execute_reply":"2024-04-27T00:19:17.518824Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#By Sohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook\n\ntry:\n    whoosh_utils.execute_query(query, qp, searcher)\nexcept:\n    print(\"You can't use ADJ or NEAR on the CPC field.\")","metadata":{"execution":{"iopub.status.busy":"2024-04-27T00:19:22.325329Z","iopub.execute_input":"2024-04-27T00:19:22.325780Z","iopub.status.idle":"2024-04-27T00:19:22.362989Z","shell.execute_reply.started":"2024-04-27T00:19:22.325730Z","shell.execute_reply":"2024-04-27T00:19:22.361627Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#The whoosh search made sense to me till output 16 (the publish_numbers)\n\nAfter that, I couldn't get its usability. Besides, we can't use ADJ/NEAR on the cpc_codes.","metadata":{}},{"cell_type":"markdown","source":"#Dear USPTO,\n\n\nOur connection is so strong and we'd loved working with you. We may specialize on different types of intellectual property, we support you and your team.\n\n![](https://i.pinimg.com/236x/c1/3e/27/c13e27aa302e13f8e0b79470f0cf0fc8.jpg)Pinterest","metadata":{}},{"cell_type":"markdown","source":"#And, Cut! Keep Whooshing, keep Kaggling!","metadata":{}},{"cell_type":"markdown","source":"#Acknowledgements:  (All Authors Names begin with S? \n\nSeshuRajup https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-whoosh-utils-eda/notebook\n\nSalman Chen https://www.kaggle.com/salmanhiro/covids-incubation-transmission-related-articles/comments\n\nSohier Dane https://www.kaggle.com/code/sohier/basic-whoosh-search-demo/notebook","metadata":{}}]}