This project is a tool to optimize complex PubMed search queries by automatically removing redundant OR keywords. It uses a combination of query parsing and Selenium automation to streamline searches and ensure the query returns the desired results.
The tool:
- Parses a PubMed search query into its nested components.
- Identifies minimal operator groups (those containing AND/OR).
- Reconstructs the query by wrapping each keyword in parentheses.
- Uses Selenium to automate the PubMed search and verify result counts.
- Iteratively removes redundant keywords to optimize the query.
- Python 3.7+
- Selenium
- ChromeDriver (Ensure it is installed and available in your system's PATH)
-
Clone the Repository:
git clone https://github.com/yourusername/pubmed-query-optimizer.git cd pubmed-query-optimizer -
Create a Virtual Environment (Optional but Recommended):
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies:
pip install selenium
-
Download ChromeDriver:
- Visit ChromeDriver Downloads and download the version that matches your Chrome browser.
- Make sure the
chromedriverexecutable is in your PATH or in the project directory.
Run the main script with your PubMed query as a command-line argument:
python main.py --query "YOUR_QUERY_HERE"