Skip to content

Conversation

@praveshkumar1988
Copy link
Collaborator

…eval

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves NLTK resource management and error handling in the GCS document retrieval system. The changes make the code more robust by preventing duplicate NLTK data path entries, providing clearer logging messages, and handling potential None values from PDF text extraction.

Key Changes:

  • Refactored NLTK resource initialization to avoid duplicate path entries and streamline resource downloading
  • Enhanced logging to specify download locations and indicate when resources are missing
  • Added null-safety guard for PDF text extraction

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 66 to 67
if "/usr/local/nltk_data" not in nltk.data.path:
nltk.data.path.append("/usr/local/nltk_data")
Copy link

Copilot AI Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicate check for '/usr/local/nltk_data' is redundant. The path is already checked and added in lines 51-53 before the resource download loop. Remove this redundant check to improve code clarity.

Suggested change
if "/usr/local/nltk_data" not in nltk.data.path:
nltk.data.path.append("/usr/local/nltk_data")

Copilot uses AI. Check for mistakes.
nltk.download(resource, download_dir=os.path.expanduser("~/.nltk_data"))
logging.info(f"NLTK resource '{res}' not found; downloading to /usr/local/nltk_data")
nltk.download(res, download_dir="/usr/local/nltk_data")

Copy link

Copilot AI Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace on this blank line should be removed for consistency with project style.

Suggested change

Copilot uses AI. Check for mistakes.
@praveshkumar1988 praveshkumar1988 merged commit c0a997a into dev Oct 24, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants