From 0600256e5d9a609e0954c3e6297d818047ad8cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Ba=C3=B1ados=20Schwerter?= Date: Mon, 21 Oct 2024 18:13:17 +0000 Subject: [PATCH] CreeDictionary is gone (except for docs and one command to be done later --- codecov.yml | 2 +- docker/docker-compose-dev.yml | 4 +- docker/docker-compose.yml | 28 +++++------ docker/helpers/app.py | 6 +-- docs/directory-structure.md | 50 +++++++++++-------- iOS/app/sync-python | 3 +- mypy.ini | 6 +-- scripts/reformat-altlabels | 2 +- .../{CreeDictionary => morphodict}/about.html | 0 .../{CreeDictionary => morphodict}/index.html | 0 src/morphodict/cvd/news-vectors.ipynb | 2 +- src/morphodict/frontend/apps.py | 4 +- .../components/citations.html | 0 .../components/definition-title.html | 2 +- .../definition__elaboration--verbose.html | 0 .../components/definition__elaboration.html | 6 +-- .../components/definition__icons.html | 2 +- .../components/header.html | 0 .../components/lexical-breakdown.html | 0 .../components/lexical-info.html | 0 .../components/linguistic-breakdown.html | 0 .../components/paradigm-label-switcher.html | 0 .../components/paradigm-size-button.html | 0 .../components/paradigm.html | 2 +- .../components/search-result.html | 12 ++--- .../components/search.html | 0 .../components/title.html | 0 .../contact-us.html | 0 .../fst-tool.html | 0 .../legend.html | 0 .../query-help.html | 0 .../search-results.html | 0 .../settings.html | 0 .../svg-sprites.html | 0 .../svg-sprites/README.md | 0 .../svg-sprites/play-solid.svg-path | 0 .../svg-sprites/volume-up-solid.svg-path | 0 .../word-detail.html | 4 +- src/morphodict/frontend/views.py | 24 ++++----- .../{CreeDictionary => morphodict}/about.html | 0 .../lexicon/templates/morphodict/base.html | 8 +-- .../{CreeDictionary => morphodict}/index.html | 0 src/morphodict/phrase_translate/README.md | 4 +- .../commands/runsamplequeriesonbranches.py | 3 +- src/morphodict/site/settings.py | 4 +- .../tests/test_context_processors.py | 2 +- src/morphodict/tests/test_url_extras.py | 4 +- src/morphodict/urls.py | 6 +-- 48 files changed, 97 insertions(+), 93 deletions(-) rename src/crkeng/app/templates/{CreeDictionary => morphodict}/about.html (100%) rename src/crkeng/app/templates/{CreeDictionary => morphodict}/index.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/citations.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/definition-title.html (95%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/definition__elaboration--verbose.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/definition__elaboration.html (94%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/definition__icons.html (82%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/header.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/lexical-breakdown.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/lexical-info.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/linguistic-breakdown.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/paradigm-label-switcher.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/paradigm-size-button.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/paradigm.html (98%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/search-result.html (86%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/search.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/components/title.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/contact-us.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/fst-tool.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/legend.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/query-help.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/search-results.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/settings.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/svg-sprites.html (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/svg-sprites/README.md (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/svg-sprites/play-solid.svg-path (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/svg-sprites/volume-up-solid.svg-path (100%) rename src/morphodict/frontend/templates/{CreeDictionary => morphodict}/word-detail.html (92%) rename src/morphodict/lexicon/templates/{CreeDictionary => morphodict}/about.html (100%) rename src/morphodict/lexicon/templates/{CreeDictionary => morphodict}/index.html (100%) diff --git a/codecov.yml b/codecov.yml index d79c587cd..eb1cd05c2 100644 --- a/codecov.yml +++ b/codecov.yml @@ -9,4 +9,4 @@ coverage: ignore: # Ignore Django Migrations - - "CreeDictionary/API/migrations/**/*" + - "src/**/migrations/**/*" diff --git a/docker/docker-compose-dev.yml b/docker/docker-compose-dev.yml index 750e41955..71c7cf216 100644 --- a/docker/docker-compose-dev.yml +++ b/docker/docker-compose-dev.yml @@ -25,8 +25,8 @@ services: # LFS mounts - "../src/morphodict/lexicon/resources/vector_models/:/app/src/morphodict/lexicon/resources/vector_models/:ro" - "../src/crkeng/resources/fst:/app/src/crkeng/resources/fst:ro" - - "../src/CreeDictionary/res/fst/:/app/src/CreeDictionary/res/fst/:ro" - - "../src/CreeDictionary/res/:/app/src/CreeDictionary/res/:ro" + - "../src/morphodict/resources/fst/:/app/src/morphodict/resources/fst/:ro" + - "../src/morphodict/resources/:/app/src/morphodict/resources/:ro" - "../src/crkeng/resources/dictionary/:/app/src/crkeng/resources/dictionary/:ro" - "/data_local/application-data/crkeng-dev/vector_models:/app/src/crkeng/resources/vector_models/" diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index f69593ae0..726af5b5d 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -21,8 +21,8 @@ services: # LFS mounts - "../src/morphodict/lexicon/resources/vector_models/:/app/src/morphodict/lexicon/resources/vector_models/:ro" - "../src/crkeng/resources/fst:/app/src/crkeng/resources/fst:ro" - - "../src/CreeDictionary/res/fst/:/app/src/CreeDictionary/res/fst/:ro" - - "../src/CreeDictionary/res/:/app/src/CreeDictionary/res/:ro" + - "../src/morphodict/resources/fst/:/app/src/morphodict/resources/fst/:ro" + - "../src/morphodict/resources/:/app/src/morphodict/resources/:ro" - "../src/crkeng/resources/dictionary/:/app/src/crkeng/resources/dictionary/:ro" - "/data_local/application-data/crkeng/vector_models:/app/src/crkeng/resources/vector_models/" @@ -44,8 +44,8 @@ services: # LFS mounts - "../src/morphodict/lexicon/resources/vector_models/:/app/src/morphodict/lexicon/resources/vector_models/:ro" - "../src/cwdeng/resources/fst:/app/src/cwdeng/resources/fst:ro" - - "../src/CreeDictionary/res/fst/:/app/src/CreeDictionary/res/fst/:ro" - - "../src/CreeDictionary/res/:/app/src/CreeDictionary/res/:ro" + - "../src/morphodict/resources/fst/:/app/src/morphodict/resources/fst/:ro" + - "../src/morphodict/resources/:/app/src/morphodict/resources/:ro" - "../src/cwdeng/resources/dictionary/:/app/src/cwdeng/resources/dictionary/:ro" - "/data_local/application-data/cwdeng/vector_models:/app/src/cwdeng/resources/vector_models/" @@ -67,8 +67,8 @@ services: # LFS mounts - "../src/morphodict/lexicon/resources/vector_models/:/app/src/morphodict/lexicon/resources/vector_models/:ro" - "../src/srseng/resources/fst:/app/src/srseng/resources/fst:ro" - - "../src/CreeDictionary/res/fst/:/app/src/CreeDictionary/res/fst/:ro" - - "../src/CreeDictionary/res/:/app/src/CreeDictionary/res/:ro" + - "../src/morphodict/resources/fst/:/app/src/morphodict/resources/fst/:ro" + - "../src/morphodict/resources/:/app/src/morphodict/resources/:ro" - "../src/srseng/resources/dictionary/:/app/src/srseng/resources/dictionary/:ro" - "/data_local/application-data/srseng/vector_models:/app/src/srseng/resources/vector_models/" @@ -90,8 +90,8 @@ services: # LFS mounts - "../src/morphodict/lexicon/resources/vector_models/:/app/src/morphodict/lexicon/resources/vector_models/:ro" - "../src/arpeng/resources/fst:/app/src/arpeng/resources/fst:ro" - - "../src/CreeDictionary/res/fst/:/app/src/CreeDictionary/res/fst/:ro" - - "../src/CreeDictionary/res/:/app/src/CreeDictionary/res/:ro" + - "../src/morphodict/resources/fst/:/app/src/morphodict/resources/fst/:ro" + - "../src/morphodict/resources/:/app/src/morphodict/resources/:ro" - "../src/arpeng/resources/dictionary/:/app/src/arpeng/resources/dictionary/:ro" - "/data_local/application-data/arpeng/vector_models:/app/src/arpeng/resources/vector_models/" @@ -113,8 +113,8 @@ services: # LFS mounts - "../src/morphodict/lexicon/resources/vector_models/:/app/src/morphodict/lexicon/resources/vector_models/:ro" - "../src/hdneng/resources/fst:/app/src/hdneng/resources/fst:ro" - - "../src/CreeDictionary/res/fst/:/app/src/CreeDictionary/res/fst/:ro" - - "../src/CreeDictionary/res/:/app/src/CreeDictionary/res/:ro" + - "../src/morphodict/resources/fst/:/app/src/morphodict/resources/fst/:ro" + - "../src/morphodict/resources/:/app/src/morphodict/resources/:ro" - "../src/hdneng/resources/dictionary/:/app/src/hdneng/resources/dictionary/:ro" - "/data_local/application-data/hdneng/vector_models:/app/src/hdneng/resources/vector_models/" @@ -136,8 +136,8 @@ services: # LFS mounts - "../src/morphodict/lexicon/resources/vector_models/:/app/src/morphodict/lexicon/resources/vector_models/:ro" - "../src/crkLacombeeng/resources/fst:/app/src/crkLacombeeng/resources/fst:ro" - - "../src/CreeDictionary/res/fst/:/app/src/CreeDictionary/res/fst/:ro" - - "../src/CreeDictionary/res/:/app/src/CreeDictionary/res/:ro" + - "../src/morphodict/resources/fst/:/app/src/morphodict/resources/fst/:ro" + - "../src/morphodict/resources/:/app/src/morphodict/resources/:ro" - "../src/crkLacombeeng/resources/dictionary/:/app/src/crkLacombeeng/resources/dictionary/:ro" - "/data_local/application-data/crkLacombeeng/vector_models:/app/src/crkLacombeeng/resources/vector_models/" @@ -159,8 +159,8 @@ services: # LFS mounts - "../src/morphodict/lexicon/resources/vector_models/:/app/src/morphodict/lexicon/resources/vector_models/:ro" - "../src/blaeng/resources/fst:/app/src/blaeng/resources/fst:ro" - - "../src/CreeDictionary/res/fst/:/app/src/CreeDictionary/res/fst/:ro" - - "../src/CreeDictionary/res/:/app/src/CreeDictionary/res/:ro" + - "../src/morphodict/resources/fst/:/app/src/morphodict/resources/fst/:ro" + - "../src/morphodict/resources/:/app/src/morphodict/resources/:ro" - "../src/blaeng/resources/dictionary/:/app/src/blaeng/resources/dictionary/:ro" - "/data_local/application-data/blaeng/vector_models:/app/src/blaeng/resources/vector_models/" diff --git a/docker/helpers/app.py b/docker/helpers/app.py index 2bd66c30f..aee10a24f 100644 --- a/docker/helpers/app.py +++ b/docker/helpers/app.py @@ -16,9 +16,9 @@ def lfs_mounts(self): return [ "morphodict/lexicon/resources/vector_models/", f"{self.name}/resources/fst", - # Holds phrase-translation FSTs - "CreeDictionary/res/fst/", - "CreeDictionary/res/", + # Holds phrase-translation FSTs TODO move to phrase_translate package + "morphodict/resources/fst/", + "morphodict/resources/", # Not actually an LFS thing, but this is where production dictionary # files get stored so they can be imported. f"{self.name}/resources/dictionary/", diff --git a/docs/directory-structure.md b/docs/directory-structure.md index 5edfa3876..f73a93820 100644 --- a/docs/directory-structure.md +++ b/docs/directory-structure.md @@ -63,28 +63,11 @@ to: │ ├ reformat-altlabels │ └ … └── src/ - ├── CreeDictionary/ # existing code, eventually goes away - │ ├── __init__.py - │ ├── API/ # this name goes away :( - │ └── CreeDictionary/ # this goes away too - │ ├── __init__.py - │ ├── models.py - │ ├── views.py - │ └── … - │ ├── morphodict/ # python package for language-independent code │ ├── __init__.py - │ ├── cvd/ - │ ├── lexicon/ # django app with primary database tables - │ │ ├── __init__.py - │ │ ├── models.py - │ │ ├── management/ - │ │ │ └── commands/ - │ │ │ └── importjsondict.py - │ │ ├── parser.py - │ │ ├── test_parser.py # test_* files are mixed in with non-test source code - │ │ └── testdata/ # Use `testdata` directories for test data - │ ├── paradigm_filler/ + │ ├── analysis/ # package containing FST analysis code + │ ├── api/ # back-end api endpoints, currently just for click_in_text + │ ├── cvd/ # vector-based similarity (Cosine Vector Distance) │ ├── frontend/ # The existing front-end code moves here from src │ │ ├── dom-utils.js │ │ ├── index.js @@ -94,6 +77,26 @@ to: │ ⋮ ├── styles.css │ ├── variables.css │ └── … + │ ├── lexicon/ # django app with primary database tables + │ │ ├── __init__.py + │ │ ├── models.py + │ │ ├── management/ + │ │ │ └── commands/ + │ │ │ └── importjsondict.py + │ │ ├── parser.py + │ │ ├── test_parser.py # test_* files are mixed in with non-test source code + │ │ └── testdata/ # Use `testdata` directories for test data + │ ├── orthography/ # Multi-orthography setup + │ ├── paradigm/ + │ ├── phrase_translate/ # English Phrase Translation generalcode + │ │ ├── sssttt/ # Source to Target (e.g. cwd -> eng) + │ │ └── tttsss/ # Target to Source (e.g. eng -> cwd) + │ ├── preference/ + │ ├── relabelling/ # Code for relabellings + │ ├── search/ # Code for search + │ │ └── quality/ # Search quality code previously in search_quality + │ ├── tests/ # Most of the tests. + │ └── utils/ # General-purpose utility code │ ├── crkeng/ # python package for itwêwina │ ├── __init__.py @@ -211,7 +214,12 @@ by all means, update this plan. The rough idea is: - A `crkeng` directory is created for itwêwina following the new structure. - It imports all the code from `CreeDictionary`. + It imports all the code from `CreeDictionary`. **Note: As of October 2024,** + **the `CreeDictionary` package has been removed.** It is referenced in + this document for historical reasons. We are keeping it around in this + document until the internal package refactorings in `morphodict` reaches + a stable state so that we can guarantee it is truly a language independent + dictionary system. - Work on itwêwina continues in the `CreeDictionary` package as normal, it’s just moved into the `src` directory, and gets run from diff --git a/iOS/app/sync-python b/iOS/app/sync-python index cb61a3965..f4745a390 100755 --- a/iOS/app/sync-python +++ b/iOS/app/sync-python @@ -21,7 +21,7 @@ SRC_DIR="${PROJECT_DIR}/../../src" # Where to sync it so that a copy ends up inside the iOS app APP_PYTHON_DIR="${PROJECT_DIR}/app_python" -STYLES_FILE="${SRC_DIR}/${SSSTTT}/collected-static/CreeDictionary/css/styles.css" +STYLES_FILE="${SRC_DIR}/${SSSTTT}/collected-static/morphodict/styles.css" if ! [ -f "${STYLES_FILE}" ]; then echo "${PROG}: styles file ${STYLES_FILE} not found" 1>&2 echo "run ‘npx rollup -c && ./${SSSTTT}-manage collectstatic’ first" 1>&2 @@ -46,7 +46,6 @@ rsync -avv --delete --delete-excluded \ --include="/${SSSTTT}" \ --include='/mobile.py' \ --include='/morphodict' \ - --include='/CreeDictionary' \ --exclude='/*' \ --include='**/' \ --include='*.py' \ diff --git a/mypy.ini b/mypy.ini index d6ffc71dd..7461c9c26 100644 --- a/mypy.ini +++ b/mypy.ini @@ -5,11 +5,7 @@ mypy_path = ./src [mypy.plugins.django-stubs] django_settings_module = crkeng.site.settings -[mypy-CreeDictionary.API.migrations.*] -# Skip checking Django-auto-generated migration code -ignore_errors = True - -[mypy-morphodict.lexicon.migrations.*] +[mypy-*.migrations.*] # Skip checking Django-auto-generated migration code ignore_errors = True diff --git a/scripts/reformat-altlabels b/scripts/reformat-altlabels index 41e5a6357..ef679a8e5 100755 --- a/scripts/reformat-altlabels +++ b/scripts/reformat-altlabels @@ -12,7 +12,7 @@ from pathlib import Path # Figure out shared_res_dir top_dir = Path(__file__).parent.parent -add_to_path = top_dir / "src" / "CreeDictionary" +add_to_path = top_dir / "src" / "morphodict" assert add_to_path.is_dir() sys.path.insert(0, str(add_to_path)) shared_res_dir = __import__("utils").shared_res_dir diff --git a/src/crkeng/app/templates/CreeDictionary/about.html b/src/crkeng/app/templates/morphodict/about.html similarity index 100% rename from src/crkeng/app/templates/CreeDictionary/about.html rename to src/crkeng/app/templates/morphodict/about.html diff --git a/src/crkeng/app/templates/CreeDictionary/index.html b/src/crkeng/app/templates/morphodict/index.html similarity index 100% rename from src/crkeng/app/templates/CreeDictionary/index.html rename to src/crkeng/app/templates/morphodict/index.html diff --git a/src/morphodict/cvd/news-vectors.ipynb b/src/morphodict/cvd/news-vectors.ipynb index df806a299..3dc62be82 100644 --- a/src/morphodict/cvd/news-vectors.ipynb +++ b/src/morphodict/cvd/news-vectors.ipynb @@ -65,7 +65,7 @@ " return directory\n", "\n", "ROOT = find_project_root()\n", - "VECTOR_DIR = ROOT / 'CreeDictionary' / 'res' / 'vector_models'" + "VECTOR_DIR = ROOT / 'morphodict' / 'resources' / 'vector_models'" ] }, { diff --git a/src/morphodict/frontend/apps.py b/src/morphodict/frontend/apps.py index 4fdaa4843..fae0ebff4 100644 --- a/src/morphodict/frontend/apps.py +++ b/src/morphodict/frontend/apps.py @@ -1,5 +1,5 @@ from django.apps import AppConfig -class CreeDictionaryConfig(AppConfig): - name = "CreeDictionary.CreeDictionary" +class MorphodictConfig(AppConfig): + name = "morphodict.frontend" diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/citations.html b/src/morphodict/frontend/templates/morphodict/components/citations.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/components/citations.html rename to src/morphodict/frontend/templates/morphodict/components/citations.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/definition-title.html b/src/morphodict/frontend/templates/morphodict/components/definition-title.html similarity index 95% rename from src/morphodict/frontend/templates/CreeDictionary/components/definition-title.html rename to src/morphodict/frontend/templates/morphodict/components/definition-title.html index ea02a91b2..f13569eb5 100644 --- a/src/morphodict/frontend/templates/CreeDictionary/components/definition-title.html +++ b/src/morphodict/frontend/templates/morphodict/components/definition-title.html @@ -50,6 +50,6 @@

{% endspaceless %} diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/definition__elaboration--verbose.html b/src/morphodict/frontend/templates/morphodict/components/definition__elaboration--verbose.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/components/definition__elaboration--verbose.html rename to src/morphodict/frontend/templates/morphodict/components/definition__elaboration--verbose.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/definition__elaboration.html b/src/morphodict/frontend/templates/morphodict/components/definition__elaboration.html similarity index 94% rename from src/morphodict/frontend/templates/CreeDictionary/components/definition__elaboration.html rename to src/morphodict/frontend/templates/morphodict/components/definition__elaboration.html index a28476c0d..5d7a87493 100644 --- a/src/morphodict/frontend/templates/CreeDictionary/components/definition__elaboration.html +++ b/src/morphodict/frontend/templates/morphodict/components/definition__elaboration.html @@ -54,7 +54,7 @@ {% endif %} - {% include "CreeDictionary/components/lexical-breakdown.html" %} + {% include "morphodict/components/lexical-breakdown.html" %} {% endif %} {% if display_options.mode == 'english' %} @@ -73,7 +73,7 @@ {% endif %} - {% include "CreeDictionary/components/lexical-breakdown.html" %} + {% include "morphodict/components/lexical-breakdown.html" %} {% endif %} {% if display_options.mode == 'source_language' %} @@ -92,7 +92,7 @@ {% endif %} - {% include "CreeDictionary/components/lexical-breakdown.html" %} + {% include "morphodict/components/lexical-breakdown.html" %} {% endif %} {% endwith %} diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/definition__icons.html b/src/morphodict/frontend/templates/morphodict/components/definition__icons.html similarity index 82% rename from src/morphodict/frontend/templates/CreeDictionary/components/definition__icons.html rename to src/morphodict/frontend/templates/morphodict/components/definition__icons.html index b094bcbec..41811af3b 100644 --- a/src/morphodict/frontend/templates/CreeDictionary/components/definition__icons.html +++ b/src/morphodict/frontend/templates/morphodict/components/definition__icons.html @@ -12,7 +12,7 @@ {% endcomment %}
- {% include "CreeDictionary/components/linguistic-breakdown.html" %} + {% include "morphodict/components/linguistic-breakdown.html" %} {# NB: 🔊 Recording button is added here dynamically by JavaScript #}
{% endspaceless %} diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/header.html b/src/morphodict/frontend/templates/morphodict/components/header.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/components/header.html rename to src/morphodict/frontend/templates/morphodict/components/header.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/lexical-breakdown.html b/src/morphodict/frontend/templates/morphodict/components/lexical-breakdown.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/components/lexical-breakdown.html rename to src/morphodict/frontend/templates/morphodict/components/lexical-breakdown.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/lexical-info.html b/src/morphodict/frontend/templates/morphodict/components/lexical-info.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/components/lexical-info.html rename to src/morphodict/frontend/templates/morphodict/components/lexical-info.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/linguistic-breakdown.html b/src/morphodict/frontend/templates/morphodict/components/linguistic-breakdown.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/components/linguistic-breakdown.html rename to src/morphodict/frontend/templates/morphodict/components/linguistic-breakdown.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/paradigm-label-switcher.html b/src/morphodict/frontend/templates/morphodict/components/paradigm-label-switcher.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/components/paradigm-label-switcher.html rename to src/morphodict/frontend/templates/morphodict/components/paradigm-label-switcher.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/paradigm-size-button.html b/src/morphodict/frontend/templates/morphodict/components/paradigm-size-button.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/components/paradigm-size-button.html rename to src/morphodict/frontend/templates/morphodict/components/paradigm-size-button.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/paradigm.html b/src/morphodict/frontend/templates/morphodict/components/paradigm.html similarity index 98% rename from src/morphodict/frontend/templates/CreeDictionary/components/paradigm.html rename to src/morphodict/frontend/templates/morphodict/components/paradigm.html index fa673f380..95f7ec1a0 100644 --- a/src/morphodict/frontend/templates/CreeDictionary/components/paradigm.html +++ b/src/morphodict/frontend/templates/morphodict/components/paradigm.html @@ -92,6 +92,6 @@ - {% include "CreeDictionary/components/paradigm-size-button.html" %} + {% include "morphodict/components/paradigm-size-button.html" %} {% endspaceless %} diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/search-result.html b/src/morphodict/frontend/templates/morphodict/components/search-result.html similarity index 86% rename from src/morphodict/frontend/templates/CreeDictionary/components/search-result.html rename to src/morphodict/frontend/templates/morphodict/components/search-result.html index 5b9477c9c..8610b25fb 100644 --- a/src/morphodict/frontend/templates/CreeDictionary/components/search-result.html +++ b/src/morphodict/frontend/templates/morphodict/components/search-result.html @@ -48,9 +48,9 @@
- {% include "CreeDictionary/components/definition-title.html" %} + {% include "morphodict/components/definition-title.html" %} {% if result.is_lemma %} - {% include "CreeDictionary/components/definition__elaboration.html" with lemma=result.lemma_wordform %} + {% include "morphodict/components/definition__elaboration.html" with lemma=result.lemma_wordform %} {% endif %}
@@ -58,12 +58,12 @@
    {% for def in result.definitions %}
  1. {{ def.text }} - {% include "CreeDictionary/components/citations.html" with dictionary_sources=def.source_ids %} + {% include "morphodict/components/citations.html" with dictionary_sources=def.source_ids %}
  2. {% endfor %}
- {% include "CreeDictionary/components/lexical-info.html" %} + {% include "morphodict/components/lexical-info.html" %} {# Show the matched lemma (when this is NOT a lemma). #} {% if not result.is_lemma and result.show_form_of %} @@ -91,14 +91,14 @@

- {% include 'CreeDictionary/components/definition__elaboration.html' with lemma=result.lemma_wordform %} + {% include 'morphodict/components/definition__elaboration.html' with lemma=result.lemma_wordform %} {# Theses are the definitions for the lemma, guaranteed to exist in the database #}
    {% for def in result.lemma_wordform.definitions %}
  1. {{ def.text }} - {% include "CreeDictionary/components/citations.html" with dictionary_sources=def.source_ids %} + {% include "morphodict/components/citations.html" with dictionary_sources=def.source_ids %}
  2. {% endfor %}
diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/search.html b/src/morphodict/frontend/templates/morphodict/components/search.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/components/search.html rename to src/morphodict/frontend/templates/morphodict/components/search.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/components/title.html b/src/morphodict/frontend/templates/morphodict/components/title.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/components/title.html rename to src/morphodict/frontend/templates/morphodict/components/title.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/contact-us.html b/src/morphodict/frontend/templates/morphodict/contact-us.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/contact-us.html rename to src/morphodict/frontend/templates/morphodict/contact-us.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/fst-tool.html b/src/morphodict/frontend/templates/morphodict/fst-tool.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/fst-tool.html rename to src/morphodict/frontend/templates/morphodict/fst-tool.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/legend.html b/src/morphodict/frontend/templates/morphodict/legend.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/legend.html rename to src/morphodict/frontend/templates/morphodict/legend.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/query-help.html b/src/morphodict/frontend/templates/morphodict/query-help.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/query-help.html rename to src/morphodict/frontend/templates/morphodict/query-help.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/search-results.html b/src/morphodict/frontend/templates/morphodict/search-results.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/search-results.html rename to src/morphodict/frontend/templates/morphodict/search-results.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/settings.html b/src/morphodict/frontend/templates/morphodict/settings.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/settings.html rename to src/morphodict/frontend/templates/morphodict/settings.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/svg-sprites.html b/src/morphodict/frontend/templates/morphodict/svg-sprites.html similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/svg-sprites.html rename to src/morphodict/frontend/templates/morphodict/svg-sprites.html diff --git a/src/morphodict/frontend/templates/CreeDictionary/svg-sprites/README.md b/src/morphodict/frontend/templates/morphodict/svg-sprites/README.md similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/svg-sprites/README.md rename to src/morphodict/frontend/templates/morphodict/svg-sprites/README.md diff --git a/src/morphodict/frontend/templates/CreeDictionary/svg-sprites/play-solid.svg-path b/src/morphodict/frontend/templates/morphodict/svg-sprites/play-solid.svg-path similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/svg-sprites/play-solid.svg-path rename to src/morphodict/frontend/templates/morphodict/svg-sprites/play-solid.svg-path diff --git a/src/morphodict/frontend/templates/CreeDictionary/svg-sprites/volume-up-solid.svg-path b/src/morphodict/frontend/templates/morphodict/svg-sprites/volume-up-solid.svg-path similarity index 100% rename from src/morphodict/frontend/templates/CreeDictionary/svg-sprites/volume-up-solid.svg-path rename to src/morphodict/frontend/templates/morphodict/svg-sprites/volume-up-solid.svg-path diff --git a/src/morphodict/frontend/templates/CreeDictionary/word-detail.html b/src/morphodict/frontend/templates/morphodict/word-detail.html similarity index 92% rename from src/morphodict/frontend/templates/CreeDictionary/word-detail.html rename to src/morphodict/frontend/templates/morphodict/word-detail.html index ac430b2db..26aec00d4 100644 --- a/src/morphodict/frontend/templates/CreeDictionary/word-detail.html +++ b/src/morphodict/frontend/templates/morphodict/word-detail.html @@ -30,7 +30,7 @@

- {% include "CreeDictionary/components/definition__elaboration.html" with lemma=wordform verbose=True %} + {% include "morphodict/components/definition__elaboration.html" with lemma=wordform verbose=True %}
    {% for def in wordform.definitions %}
  1. {{ def.text }} - {% include "CreeDictionary/components/citations.html" with dictionary_sources=def.source_ids %} + {% include "morphodict/components/citations.html" with dictionary_sources=def.source_ids %}
  2. {% endfor %}
diff --git a/src/morphodict/frontend/views.py b/src/morphodict/frontend/views.py index a232d0773..552ec9945 100644 --- a/src/morphodict/frontend/views.py +++ b/src/morphodict/frontend/views.py @@ -15,7 +15,7 @@ import morphodict.analysis from morphodict.search import presentation, search_with_affixes -from CreeDictionary.CreeDictionary.forms import WordSearchForm +from morphodict.frontend.forms import WordSearchForm from morphodict.paradigm.generation import default_paradigm_manager from morphodict.phrase_translate.translate import ( eng_noun_entry_to_inflected_phrase_fst, @@ -108,7 +108,7 @@ def entry_details(request, slug: str): context["show_morphemes"] = request.COOKIES.get("show_morphemes") context["morphemes"] = morphemes context["show_ic"] = request.COOKIES.get("show_inflectional_category") - return render(request, "CreeDictionary/index.html", context) + return render(request, "morphodict/index.html", context) def index(request): # pragma: no cover @@ -164,7 +164,7 @@ def index(request): # pragma: no cover context["verbose_messages"] = json.dumps( search_run.verbose_messages, indent=2, ensure_ascii=False ) - return render(request, "CreeDictionary/index.html", context) + return render(request, "morphodict/index.html", context) def search_results(request, query_string: str): # pragma: no cover @@ -188,7 +188,7 @@ def search_results(request, query_string: str): # pragma: no cover return render( request, - "CreeDictionary/search-results.html", + "morphodict/search-results.html", { "query_string": query_string, "search_results": results, @@ -240,7 +240,7 @@ def paradigm_internal(request): return HttpResponseBadRequest("paradigm does not exist") return render( request, - "CreeDictionary/components/paradigm.html", + "morphodict/components/paradigm.html", { "lemma": lemma, "paradigm_size": paradigm_size, @@ -254,7 +254,7 @@ def settings_page(request): # TODO: clean up template so that this weird hack is no longer needed. context = create_context_for_index_template("info-page") context["show_dict_source_setting"] = settings.SHOW_DICT_SOURCE_SETTING - return render(request, "CreeDictionary/settings.html", context) + return render(request, "morphodict/settings.html", context) def about(request): # pragma: no cover @@ -264,7 +264,7 @@ def about(request): # pragma: no cover context = create_context_for_index_template("info-page") return render( request, - "CreeDictionary/about.html", + "morphodict/about.html", context, ) @@ -276,7 +276,7 @@ def contact_us(request): # pragma: no cover context = create_context_for_index_template("info-page") return render( request, - "CreeDictionary/contact-us.html", + "morphodict/contact-us.html", context, ) @@ -288,7 +288,7 @@ def legend(request): # pragma: no cover context = create_context_for_index_template("info-page") return render( request, - "CreeDictionary/legend.html", + "morphodict/legend.html", context, ) @@ -300,7 +300,7 @@ def query_help(request): # pragma: no cover context = create_context_for_index_template("info-page") return render( request, - "CreeDictionary/query-help.html", + "morphodict/query-help.html", context, ) @@ -334,12 +334,12 @@ def decode_foma_results(fst, query): ), } - return render(request, "CreeDictionary/fst-tool.html", context) + return render(request, "morphodict/fst-tool.html", context) def create_context_for_index_template(mode: IndexPageMode, **kwargs) -> Dict[str, Any]: """ - Creates the context vars for anything using the CreeDictionary/index.html template. + Creates the context vars for anything using the morphodict/index.html template. """ context: Dict[str, Any] diff --git a/src/morphodict/lexicon/templates/CreeDictionary/about.html b/src/morphodict/lexicon/templates/morphodict/about.html similarity index 100% rename from src/morphodict/lexicon/templates/CreeDictionary/about.html rename to src/morphodict/lexicon/templates/morphodict/about.html diff --git a/src/morphodict/lexicon/templates/morphodict/base.html b/src/morphodict/lexicon/templates/morphodict/base.html index 74e457760..97bdfca89 100644 --- a/src/morphodict/lexicon/templates/morphodict/base.html +++ b/src/morphodict/lexicon/templates/morphodict/base.html @@ -57,8 +57,8 @@ {% endif %} Skip to content {% csrf_token %} -{% include 'CreeDictionary/svg-sprites.html' %} -{% include 'CreeDictionary/components/header.html' %} +{% include 'morphodict/svg-sprites.html' %} +{% include 'morphodict/components/header.html' %} {% spaceless %} {# The 🔊 button template. Gets inflated by JavaScript. #} @@ -93,13 +93,13 @@
    {% if did_search %} - {% include "CreeDictionary/search-results.html" %} + {% include "morphodict/search-results.html" %} {% endif %}
{% if displaying_paradigm %} - {% include 'CreeDictionary/word-detail.html' %} + {% include 'morphodict/word-detail.html' %} {% endif %} {% endblock %}{# content #} diff --git a/src/morphodict/lexicon/templates/CreeDictionary/index.html b/src/morphodict/lexicon/templates/morphodict/index.html similarity index 100% rename from src/morphodict/lexicon/templates/CreeDictionary/index.html rename to src/morphodict/lexicon/templates/morphodict/index.html diff --git a/src/morphodict/phrase_translate/README.md b/src/morphodict/phrase_translate/README.md index 265c12379..a707f3b79 100644 --- a/src/morphodict/phrase_translate/README.md +++ b/src/morphodict/phrase_translate/README.md @@ -6,9 +6,9 @@ The process to update the auto-translated phrases is as follows: quick.mk fsts.zip` 2. Copy the generated `transcriptor-cw-eng*` files to - `CreeDictionary/res/fst` in this repo. + `morphodict/resources/fst` in this repo. - 3. Run the unit tests: `pipenv run pytest CreeDictionary` + 3. Run the unit tests: `pipenv run pytest src` 4. The english phrase FSTs are used: - By by the `importjsondict` django command, which populates the auto definitions diff --git a/src/morphodict/search_quality/management/commands/runsamplequeriesonbranches.py b/src/morphodict/search_quality/management/commands/runsamplequeriesonbranches.py index 5774e9e66..757303b5e 100644 --- a/src/morphodict/search_quality/management/commands/runsamplequeriesonbranches.py +++ b/src/morphodict/search_quality/management/commands/runsamplequeriesonbranches.py @@ -227,6 +227,7 @@ def add_arguments(self, parser: ArgumentParser): ) def handle(self, *args, **options) -> None: + raise NotImplementedError("Still dependent on CreeDictionary code") if not options["branch"]: options["branch"] = DEFAULT_BRANCHES @@ -258,7 +259,7 @@ def handle(self, *args, **options) -> None: shutil.copy( sample_csv_file, branch.checkout_dir - / "CreeDictionary" + / "morphodict" / "search_quality" / "sample.csv", ) diff --git a/src/morphodict/site/settings.py b/src/morphodict/site/settings.py index 609c6f967..fa7e1c198 100644 --- a/src/morphodict/site/settings.py +++ b/src/morphodict/site/settings.py @@ -76,7 +76,7 @@ # Internal apps # TODO: our internal app organization is kind of a mess 🙃 "morphodict.api", - "CreeDictionary.CreeDictionary.apps.CreeDictionaryConfig", + "morphodict.frontend", "morphodict.cvd", "morphodict.search_quality", "morphodict.phrase_translate", @@ -111,7 +111,7 @@ "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", - "CreeDictionary.CreeDictionary.context_processors.display_options", + "morphodict.frontend.context_processors.display_options", "morphodict.lexicon.context_processors.morphodict_settings", "morphodict.preference.context_processors.preferences", ] diff --git a/src/morphodict/tests/test_context_processors.py b/src/morphodict/tests/test_context_processors.py index fec6f914e..0fbf9c508 100644 --- a/src/morphodict/tests/test_context_processors.py +++ b/src/morphodict/tests/test_context_processors.py @@ -12,7 +12,7 @@ @pytest.fixture(autouse=True) def ensure_context_processors_are_enabled(settings): desired_processor = ( - "CreeDictionary.CreeDictionary.context_processors.display_options" + "morphodict.frontend.context_processors.display_options" ) settings.TEMPLATES = [ { diff --git a/src/morphodict/tests/test_url_extras.py b/src/morphodict/tests/test_url_extras.py index dee2494b2..bbf78efb7 100644 --- a/src/morphodict/tests/test_url_extras.py +++ b/src/morphodict/tests/test_url_extras.py @@ -9,7 +9,7 @@ def test_abstatic(): """ Test that the {% abstatic %} tag returns a static path. """ - asset = "CreeDictionary/favicon.ico" + asset = "frontend/favicon.ico" django_builtin_static = render_builtin_django_static(asset) assert not django_builtin_static.startswith("http") @@ -27,7 +27,7 @@ def test_abstatic_static_url_set(settings): """ settings.STATIC_URL = "https://cdn.example.com" - asset = "CreeDictionary/favicon.ico" + asset = "frontend/favicon.ico" django_builtin_static = render_builtin_django_static(asset) abstatic_url = render_with_abstatic(asset) diff --git a/src/morphodict/urls.py b/src/morphodict/urls.py index 81c7cd98d..ad6e0a798 100644 --- a/src/morphodict/urls.py +++ b/src/morphodict/urls.py @@ -1,5 +1,5 @@ """ -Definition of urls for CreeDictionary. +Definition of urls for morphodict. """ from django.conf import settings @@ -9,8 +9,8 @@ from django.urls import include, path from django_js_reverse.views import urls_js -from CreeDictionary.CreeDictionary import views -from CreeDictionary.CreeDictionary.sitemaps import sitemaps +from morphodict.frontend import views +from morphodict.frontend.sitemaps import sitemaps # TODO: use URL namespaces: # e.g., cree-dictionary:index instead of cree-dictionary-index