-
Notifications
You must be signed in to change notification settings - Fork 4
feat: imlements syllabify of EPA text and files #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,6 @@ | ||||||||||||
| .PHONY: sync install build publish clean help test lint check tox-run check-uv run demo update-dev-requirements check-dev-requirements | ||||||||||||
| .DEFAULT_GOAL := help | ||||||||||||
|
|
||||||||||||
| .PHONY: sync install build publish clean help test lint check tox-run check-uv run demo demo-transliterate demo-syllabify update-dev-requirements check-dev-requirements add-dep | ||||||||||||
|
|
||||||||||||
| check-uv: | ||||||||||||
| @if ! command -v uv &> /dev/null; then \ | ||||||||||||
|
|
@@ -15,16 +17,24 @@ help: ## Muestra esta ayuda | |||||||||||
|
|
||||||||||||
| sync: check-uv ## Sincroniza dependencias y crea entorno virtual con uv | ||||||||||||
| @echo "🔄 Sincronizando dependencias con uv..." | ||||||||||||
| @uv sync --extra dev | ||||||||||||
| @echo "📝 Actualizando dev-requirements.txt..." | ||||||||||||
| @$(MAKE) update-dev-requirements --no-print-directory | ||||||||||||
| @uv sync | ||||||||||||
| @echo "✅ Entorno sincronizado" | ||||||||||||
|
|
||||||||||||
| sync-dev: check-uv ## Sincroniza dependencias de desarrollo | ||||||||||||
| @echo "🔄 Sincronizando dependencias con uv..." | ||||||||||||
| @uv sync --extra dev | ||||||||||||
| @echo "✅ Entorno dev sincronizado" | ||||||||||||
|
|
||||||||||||
| install: check-uv sync ## Instala el módulo andaluh en modo desarrollo | ||||||||||||
| @echo "⚙️ Instalando módulo andaluh en modo desarrollo..." | ||||||||||||
| @uv pip install -e . | ||||||||||||
| @echo "✅ Módulo andaluh instalado en modo desarrollo" | ||||||||||||
|
|
||||||||||||
| install-editable: check-uv sync ## Instala el módulo andaluh en modo desarrollo | ||||||||||||
|
||||||||||||
| install-editable: check-uv sync ## Instala el módulo andaluh en modo desarrollo | |
| install-editable: check-uv sync-dev ## Instala el módulo andaluh en modo desarrollo |
Copilot
AI
Jul 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The 'install-editable' target duplicates the 'install' target. Consider consolidating these to avoid duplicated logic.
| install-editable: check-uv sync ## Instala el módulo andaluh en modo desarrollo | |
| @echo "⚙️ Instalando módulo andaluh en modo desarrollo..." | |
| @uv pip install -e . | |
| @echo "✅ Módulo andaluh instalado en modo desarrollo" | |
| install-editable: install ## Alias para instalar el módulo andaluh en modo desarrollo |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/usr/bin/env python3 | ||
| # -*- coding: utf-8 -*- | ||
| # vim: ts=4 | ||
|
|
||
| import argparse | ||
| import logging | ||
| import os | ||
| import sys | ||
| from epa_syllabifier import syllabify | ||
|
|
||
| logging.basicConfig(level=logging.INFO) | ||
|
|
||
| def syllabify_file(file_path): | ||
| output = "" | ||
| with open(file_path, "r", encoding="utf-8") as f: | ||
| for line in f: | ||
| # check if line is empty | ||
| if not line.strip(): | ||
| output += "\n\n" | ||
| continue | ||
| for word in line.split(): | ||
| stripped_word = word.strip() | ||
| if stripped_word: | ||
| try: | ||
| output += '-'.join(syllabify(stripped_word)) + " " | ||
| except Exception as e: | ||
| logging.error(f"Error syllabifying {stripped_word}: {e}") | ||
| output += stripped_word + " " | ||
| continue | ||
| return output | ||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser(description="Syllabify a word") | ||
| parser.add_argument("--word", "-w", type=str, help="The EPA word to syllabify") | ||
| parser.add_argument("--file", "-f", type=str, help="The file to syllabify") | ||
| args = parser.parse_args() | ||
| if args.word: | ||
| print('-'.join(syllabify(args.word))) | ||
| elif args.file: | ||
| if not os.path.exists(args.file): | ||
| logging.error(f"File {args.file} does not exist") | ||
| sys.exit(1) | ||
| result = syllabify_file(args.file) | ||
| print("=" * 80) | ||
| print(result) | ||
| else: | ||
| parser.print_help() | ||
| sys.exit(1) | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Uh oh!
There was an error while loading. Please reload this page.