Get started with the Coptic Dependency Parser in 5 minutes!
- Python 3.8+ installed on your system
- SWI-Prolog for grammatical validation (optional but recommended)
# Ubuntu/Debian
sudo apt-get install swi-prolog
# macOS (using Homebrew)
brew install swi-prolog
# Windows
# Download installer from: https://www.swi-prolog.org/download/stablegit clone https://github.com/Rogaton/coptic-dependency-parser.git
cd coptic-dependency-parserModern Linux systems (Ubuntu 23.04+, Debian 12+) use externally-managed Python environments. Using a virtual environment is the recommended approach to avoid conflicts:
# Create virtual environment
python3 -m venv coptic-env
# Activate it
source coptic-env/bin/activateNote: Your prompt will change to show (coptic-env) when the environment is active.
Windows users: Use coptic-env\Scripts\activate instead.
pip install -r requirements.txtThis will install all necessary packages:
stanza- Stanford NLP for Coptic tokenization and POS taggingdiaparser- Neural dependency parsertorch- PyTorch (required by the above)pyswip- Prolog integration for grammatical validationmatplotlib,numpy,pandas- Visualization and data handlingweasyprint- PDF export functionalitytqdm- Progress bars
Note: The installation may take a few minutes as PyTorch is a large package (~800MB).
If you get "externally-managed-environment" error: You must use a virtual environment (see step 2 above). Do not use --break-system-packages as it can damage your system Python installation.
#```bash pip install stanza # works but should not be necessary as stanza is installed by running the 'requirements.txt' file.
#python3 -c "import stanza; stanza.download('cop')" # Fails. Use 'pip install stanza instead if installing dependencies does not complete.
This downloads the Coptic language models (~50MB) for tokenization, POS tagging, and lemmatization.
### 5. Configure DiaParser Model (Optional)
The parser can work with either:
- **DiaParser** (recommended) - Place your trained model at `models/cop.diaparser`
- **Stanza's built-in parser** (automatic fallback) - No additional setup needed
If you have a trained DiaParser model, place it in the `models/` directory:
```bash
mkdir -p models
# Copy your cop.diaparser model to models/
Or set a custom path:
export COPTIC_DIAPARSER_MODEL=/path/to/your/cop.diaparserImportant: If you're using a virtual environment, make sure it's activated first:
source coptic-env/bin/activate # Only needed if not already activatedThen run the parser:
python3 coptic-parser.pyThe graphical interface will open with three main tabs:
- Parse Text - Input and analyze Coptic text
- Dependency Graph - View visual dependency trees
- Dependency Table - Export results to HTML or PDF
-
In the "Parse Text" tab, enter some Coptic text (or use the virtual keyboard):
ⲁⲛⲟⲕ ⲡⲉ ⲡⲛⲟⲩⲧⲉ -
Click "Parse & Analyze Dependencies"
-
View the results:
- Token-level analysis with POS tags and dependency relations
- Navigate through dependency graphs in the "Dependency Graph" tab
- Export to HTML or PDF in the "Dependency Table" tab
Solution: Make sure you've installed all dependencies:
pip install -r requirements.txtSolution: Install diaparser explicitly:
pip install diaparser>=1.1.0Solution: Download the Coptic models:
python3 -c "import stanza; stanza.download('cop')"Solution:
- Make sure SWI-Prolog is installed (see Prerequisites above)
- The parser will still work without Prolog, but grammatical validation will be disabled
Error message: error: externally-managed-environment × This environment is externally managed
Solution: You MUST use a virtual environment on modern Linux systems. Go back to step 2 and create a virtual environment:
python3 -m venv coptic-env
source coptic-env/bin/activate
pip install -r requirements.txtSolution: Create a fresh virtual environment:
# Remove old environment if it exists
rm -rf coptic-env
# Create fresh virtual environment
python3 -m venv coptic-env
# Activate it
source coptic-env/bin/activate # Linux/macOS
# OR
coptic-env\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txtSolution: Install CPU-only PyTorch for smaller download:
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -r requirements.txt- Full Documentation: See README.md for detailed features and usage
- Project Structure: Explore the codebase organization
- Configuration: Customize settings in
config.py - Data: Check
data/directory for training data and lexical resources
# Start GUI
python3 coptic-parser.py
# Download Stanza models
python3 -c "import stanza; stanza.download('cop')"
# Check configuration
python3 config.pyimport stanza
from coptic_prolog_rules import create_prolog_engine
# Initialize pipeline
nlp = stanza.Pipeline('cop', processors='tokenize,pos,lemma,depparse')
# Parse text
text = "ⲁⲛⲟⲕ ⲡⲉ ⲡⲛⲟⲩⲧⲉ"
doc = nlp(text)
# Access results
for sentence in doc.sentences:
for word in sentence.words:
print(f"{word.text}\t{word.upos}\t{word.deprel}")For issues, questions, or contributions:
- GitHub Issues: Report bugs or request features
- Email: relanir@bluewin.ch
- Documentation: See docs/README.md
Ready to parse! 🚀