Skip to content

Commit

Permalink
CreeDictionary is gone (except for docs and one command to be done later
Browse files Browse the repository at this point in the history
  • Loading branch information
fbanados committed Oct 21, 2024
1 parent ba14570 commit 0600256
Show file tree
Hide file tree
Showing 48 changed files with 97 additions and 93 deletions.
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ coverage:

ignore:
# Ignore Django Migrations
- "CreeDictionary/API/migrations/**/*"
- "src/**/migrations/**/*"
4 changes: 2 additions & 2 deletions docker/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
28 changes: 14 additions & 14 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand All @@ -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/"
Expand All @@ -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/"
Expand All @@ -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/"
Expand All @@ -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/"
Expand All @@ -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/"
Expand All @@ -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/"
Expand Down
6 changes: 3 additions & 3 deletions docker/helpers/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
50 changes: 29 additions & 21 deletions docs/directory-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions iOS/app/sync-python
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,7 +46,6 @@ rsync -avv --delete --delete-excluded \
--include="/${SSSTTT}" \
--include='/mobile.py' \
--include='/morphodict' \
--include='/CreeDictionary' \
--exclude='/*' \
--include='**/' \
--include='*.py' \
Expand Down
6 changes: 1 addition & 5 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion scripts/reformat-altlabels
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/morphodict/cvd/news-vectors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/morphodict/frontend/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.apps import AppConfig


class CreeDictionaryConfig(AppConfig):
name = "CreeDictionary.CreeDictionary"
class MorphodictConfig(AppConfig):
name = "morphodict.frontend"
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ <h2 class="definition-title__title definition__matched-head" data-cy="definition

&#32; {# separate title proper from icons #}

{% include "CreeDictionary/components/definition__icons.html" %}
{% include "morphodict/components/definition__icons.html" %}
</div>
{% endspaceless %}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</div>
{% endif %}

{% include "CreeDictionary/components/lexical-breakdown.html" %}
{% include "morphodict/components/lexical-breakdown.html" %}
{% endif %}

{% if display_options.mode == 'english' %}
Expand All @@ -73,7 +73,7 @@
</div>
{% endif %}

{% include "CreeDictionary/components/lexical-breakdown.html" %}
{% include "morphodict/components/lexical-breakdown.html" %}
{% endif %}

{% if display_options.mode == 'source_language' %}
Expand All @@ -92,7 +92,7 @@
</div>
{% endif %}

{% include "CreeDictionary/components/lexical-breakdown.html" %}
{% include "morphodict/components/lexical-breakdown.html" %}
{% endif %}
{% endwith %}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{% endcomment %}

<div class="definition__icons" data-wordform="{{ result.wordform_text }}">
{% include "CreeDictionary/components/linguistic-breakdown.html" %}
{% include "morphodict/components/linguistic-breakdown.html" %}
{# NB: 🔊 Recording button is added here dynamically by JavaScript #}
</div>
{% endspaceless %}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@
</table>
</div>

{% include "CreeDictionary/components/paradigm-size-button.html" %}
{% include "morphodict/components/paradigm-size-button.html" %}
</section>
{% endspaceless %}
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@

<article class="definition box box--rounded" data-cy="search-result">
<header class="definition__header">
{% 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 %}
</header>

{# These are the definitions for the inflection (non-lemma), could be empty #}
<ol class="meanings meanings--search-result">
{% for def in result.definitions %}
<li class="meanings__meaning" data-cy="lemma-meaning">{{ def.text }}
{% include "CreeDictionary/components/citations.html" with dictionary_sources=def.source_ids %}
{% include "morphodict/components/citations.html" with dictionary_sources=def.source_ids %}
</li>
{% endfor %}
</ol>

{% 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 %}
Expand Down Expand Up @@ -91,14 +91,14 @@ <h2 class="definition-title definition-title--search-result">
</dfn>
</h2>

{% include 'CreeDictionary/components/definition__elaboration.html' with lemma=result.lemma_wordform %}
{% include 'morphodict/components/definition__elaboration.html' with lemma=result.lemma_wordform %}
</header>

{# Theses are the definitions for the lemma, guaranteed to exist in the database #}
<ol class="meanings meanings--search-result">
{% for def in result.lemma_wordform.definitions %}
<li class="meanings__meaning" data-cy="lemma-meaning">{{ def.text }}
{% include "CreeDictionary/components/citations.html" with dictionary_sources=def.source_ids %}
{% include "morphodict/components/citations.html" with dictionary_sources=def.source_ids %}
</li>
{% endfor %}
</ol>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1 id="head" class="definition-title">
</dfn>
</h1>

{% include "CreeDictionary/components/definition__elaboration.html" with lemma=wordform verbose=True %}
{% include "morphodict/components/definition__elaboration.html" with lemma=wordform verbose=True %}
</header>

<section class="multiple-recordings definition__recordings--not-loaded" id="recordings-dropdown"
Expand Down Expand Up @@ -63,7 +63,7 @@ <h1 id="head" class="definition-title">
<ol class="meanings">
{% for def in wordform.definitions %}
<li class="meanings__meaning">{{ def.text }}
{% include "CreeDictionary/components/citations.html" with dictionary_sources=def.source_ids %}
{% include "morphodict/components/citations.html" with dictionary_sources=def.source_ids %}
</li>
{% endfor %}
</ol>
Expand Down
Loading

0 comments on commit 0600256

Please sign in to comment.