Skip to content

Conversation

Copy link

Copilot AI commented Oct 27, 2025

Dictionary JSON files were referenced from /shared/dictionaries/ at repository root using relative path traversal, causing FileNotFoundError when package was installed via pip.

Changes

  • Bundled dictionaries: Copied 24 language JSON files into packages/py/glin_profanity/data/dictionaries/
  • Fixed path resolution: Changed from current_dir.parent.parent.parent.parent / "shared" / "dictionaries" to current_dir / "dictionaries" in dictionary.py

This ensures dictionaries are included in the wheel/sdist and accessible at runtime regardless of installation method.

# Now works correctly after pip install
from glin_profanity import Filter

# Previously caused warnings and no detection
f = Filter({'all_languages': True})  # Loads 2483 words from 23 languages
f.is_profane("test content")  # Works as expected
Original prompt

This section details on the original issue you should resolve

<issue_title>Dictionary Location in Python</issue_title>
<issue_description>Hello, and thank you for the library!

I am facing an issue while using the library in python:
After I set the config all_languages: True , I have warning for all the available language's JSON files and no profanity is detected.
Moreover, I tried to add specific languages (e.g. ["english","italian"] ) but again, I had the same warning for all the languages + no profanity detection.
The warning is:
Warning: Could not load english.json: [Errno 2] No such file or directory: '/home/sara/.../.../.../venv/lib/shared/dictionaries/english.json.

I would be appreciated if you help me with it :)</issue_description>

<agent_instructions>fix build and test this issue
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link

coderabbitai bot commented Oct 27, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Fix dictionary location issue in Python library Bundle dictionaries with Python package to fix pip install Oct 27, 2025
Copilot AI requested a review from thegdsks October 27, 2025 04:10
Copilot finished work on behalf of thegdsks October 27, 2025 04:10
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.

Dictionary Location in Python

2 participants