{
  "id": 498174,
  "title": "Simple CPC Boolean Query: Notebook Threw Exception [Solved] but Score Error ? ",
  "url": "/competitions/uspto-explainable-ai/discussion/498174",
  "author_name": "",
  "post_date": "2024-04-27T05:59:08.789322Z",
  "votes": 5,
  "comment_count": 2,
  "views": 0,
  "content": "<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F761268%2Ffd625e7d55b349389adfb95141005957%2FScreenshot%202024-04-27%20at%2011.25.41AM.png?generation=1714197352831496&amp;alt=media\"></p>\n<blockquote>\n  <h1>Fixed Notebook Threw Exception</h1>\n</blockquote>\n<pre><code> whoosh_utils\nqueryValidator = whoosh_utils.QueryValidator()\nfinal_queries = []\n query  queries:\n    final_query = query\n    :\n        queryValidator.validate_query(query)\n        final_query = query\n    :\n        final_query = \n     whoosh_utils.count_query_tokens(query) &gt; :\n        final_query = \n    final_queries.append(final_query)\nfinal_queries\n</code></pre>\n<hr>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F761268%2F5404653f660644c4ebd9391c2be38547%2FScreenshot%202024-04-28%20at%201.48.38AM.png?generation=1714249161772237&amp;alt=media\"></p>\n<hr>\n<blockquote>\n  <p><strong>What is the issue with my notebook</strong><br>\n  <strong>Did i miss any edge cases</strong> ( <strong>Maybe my notebook run more than 60mins ?</strong> ) </p>\n</blockquote>\n<hr>\n<h3><a href=\"https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-cpc-boolean-query\" target=\"_blank\">Notebook - Patent Professionals USPTO: CPC Boolean Query</a></h3>\n<blockquote>\n  <p><strong>Build most common cpc code between publication and neighbor_{i}</strong><br>\n  <strong>working fine with whoosh_utils.execute_query with train_index</strong></p>\n</blockquote>",
  "messages": [
    {
      "id": "2778339",
      "postDate": "04/27/2024 05:59:08",
      "content": "<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F761268%2Ffd625e7d55b349389adfb95141005957%2FScreenshot%202024-04-27%20at%2011.25.41AM.png?generation=1714197352831496&amp;alt=media\"></p>\n<blockquote>\n  <h1>Fixed Notebook Threw Exception</h1>\n</blockquote>\n<pre><code> whoosh_utils\nqueryValidator = whoosh_utils.QueryValidator()\nfinal_queries = []\n query  queries:\n    final_query = query\n    :\n        queryValidator.validate_query(query)\n        final_query = query\n    :\n        final_query = \n     whoosh_utils.count_query_tokens(query) &gt; :\n        final_query = \n    final_queries.append(final_query)\nfinal_queries\n</code></pre>\n<hr>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F761268%2F5404653f660644c4ebd9391c2be38547%2FScreenshot%202024-04-28%20at%201.48.38AM.png?generation=1714249161772237&amp;alt=media\"></p>\n<hr>\n<blockquote>\n  <p><strong>What is the issue with my notebook</strong><br>\n  <strong>Did i miss any edge cases</strong> ( <strong>Maybe my notebook run more than 60mins ?</strong> ) </p>\n</blockquote>\n<hr>\n<h3><a href=\"https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-cpc-boolean-query\" target=\"_blank\">Notebook - Patent Professionals USPTO: CPC Boolean Query</a></h3>\n<blockquote>\n  <p><strong>Build most common cpc code between publication and neighbor_{i}</strong><br>\n  <strong>working fine with whoosh_utils.execute_query with train_index</strong></p>\n</blockquote>",
      "rawMarkdown": "![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F761268%2Ffd625e7d55b349389adfb95141005957%2FScreenshot%202024-04-27%20at%2011.25.41AM.png?generation=1714197352831496&alt=media)\n\n> # Fixed Notebook Threw Exception\n```python\nimport whoosh_utils\nqueryValidator = whoosh_utils.QueryValidator()\nfinal_queries = []\nfor query in queries:\n    final_query = query\n    try:\n        queryValidator.validate_query(query)\n        final_query = query\n    except:\n        final_query = \"ti:device\"\n    if whoosh_utils.count_query_tokens(query) > 50:\n        final_query = \"ti:device\"\n    final_queries.append(final_query)\nfinal_queries\n```\n\n---\n\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F761268%2F5404653f660644c4ebd9391c2be38547%2FScreenshot%202024-04-28%20at%201.48.38AM.png?generation=1714249161772237&alt=media)\n\n--- \n\n\n> **What is the issue with my notebook**\n> **Did i miss any edge cases** ( **Maybe my notebook run more than 60mins ?** ) \n\n---\n\n### [Notebook - Patent Professionals USPTO: CPC Boolean Query](https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-cpc-boolean-query)\n> **Build most common cpc code between publication and neighbor_{i}**\n> **working fine with whoosh_utils.execute_query with train_index**",
      "votes": null
    },
    {
      "id": "2784778",
      "postDate": "04/30/2024 13:43:28",
      "content": "<p>have you solved it?</p>",
      "rawMarkdown": "have you solved it?",
      "votes": null
    },
    {
      "id": "2784861",
      "postDate": "04/30/2024 14:21:02",
      "content": "<p><a href=\"https://www.kaggle.com/hunainimran\" target=\"_blank\">@hunainimran</a> yes, i solved partially it. Since i shared notebook before, so didn't change to private.</p>",
      "rawMarkdown": "hunainimran yes, i solved partially it. Since i shared notebook before, so didn't change to private.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2784778,
      "author_name": "hunainimran",
      "author_url": "",
      "post_date": "04/30/2024 13:43:28",
      "content": "<p>have you solved it?</p>",
      "votes": null,
      "replies": [
        {
          "id": 2784861,
          "author_name": "seshurajup",
          "author_url": "",
          "post_date": "04/30/2024 14:21:02",
          "content": "<p><a href=\"https://www.kaggle.com/hunainimran\" target=\"_blank\">@hunainimran</a> yes, i solved partially it. Since i shared notebook before, so didn't change to private.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2778339": "![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F761268%2Ffd625e7d55b349389adfb95141005957%2FScreenshot%202024-04-27%20at%2011.25.41AM.png?generation=1714197352831496&alt=media)\n\n> # Fixed Notebook Threw Exception\n```python\nimport whoosh_utils\nqueryValidator = whoosh_utils.QueryValidator()\nfinal_queries = []\nfor query in queries:\n    final_query = query\n    try:\n        queryValidator.validate_query(query)\n        final_query = query\n    except:\n        final_query = \"ti:device\"\n    if whoosh_utils.count_query_tokens(query) > 50:\n        final_query = \"ti:device\"\n    final_queries.append(final_query)\nfinal_queries\n```\n\n---\n\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F761268%2F5404653f660644c4ebd9391c2be38547%2FScreenshot%202024-04-28%20at%201.48.38AM.png?generation=1714249161772237&alt=media)\n\n--- \n\n\n> **What is the issue with my notebook**\n> **Did i miss any edge cases** ( **Maybe my notebook run more than 60mins ?** ) \n\n---\n\n### [Notebook - Patent Professionals USPTO: CPC Boolean Query](https://www.kaggle.com/code/seshurajup/patent-professionals-uspto-cpc-boolean-query)\n> **Build most common cpc code between publication and neighbor_{i}**\n> **working fine with whoosh_utils.execute_query with train_index**",
    "2784778": "have you solved it?",
    "2784861": "hunainimran yes, i solved partially it. Since i shared notebook before, so didn't change to private."
  },
  "source": "meta"
}