diff --git a/src/CreeDictionary/CreeDictionary/paradigm/crkeng_corpus_frequency.py b/src/CreeDictionary/CreeDictionary/paradigm/crkeng_corpus_frequency.py index 99a8cec5e..2c25769bd 100644 --- a/src/CreeDictionary/CreeDictionary/paradigm/crkeng_corpus_frequency.py +++ b/src/CreeDictionary/CreeDictionary/paradigm/crkeng_corpus_frequency.py @@ -1,8 +1,8 @@ import logging from functools import cache -from CreeDictionary.utils import shared_res_dir -from CreeDictionary.utils.types import ConcatAnalysis +from morphodict.utils import shared_res_dir +from morphodict.utils.types import ConcatAnalysis CORPUS_FREQUENCY_FILE = shared_res_dir / "corpus_frequency.txt" diff --git a/src/CreeDictionary/CreeDictionary/paradigm/generation.py b/src/CreeDictionary/CreeDictionary/paradigm/generation.py index 3c1a988b9..a159dae58 100644 --- a/src/CreeDictionary/CreeDictionary/paradigm/generation.py +++ b/src/CreeDictionary/CreeDictionary/paradigm/generation.py @@ -9,7 +9,7 @@ ParadigmManager, ParadigmManagerWithExplicitSizes, ) -from CreeDictionary.utils import shared_res_dir +from morphodict.utils import shared_res_dir from morphodict.site.util import cache_unless diff --git a/src/CreeDictionary/CreeDictionary/templatetags/creedictionary_extras.py b/src/CreeDictionary/CreeDictionary/templatetags/creedictionary_extras.py index 21d8cb656..76d533840 100644 --- a/src/CreeDictionary/CreeDictionary/templatetags/creedictionary_extras.py +++ b/src/CreeDictionary/CreeDictionary/templatetags/creedictionary_extras.py @@ -15,7 +15,7 @@ observed_wordforms, ) from morphodict.relabelling import read_labels -from CreeDictionary.CreeDictionary.utils import url_for_query +from morphodict.utils import url_for_query from CreeDictionary.morphodict.templatetags.morphodict_orth import orth_tag from morphodict.lexicon.models import Wordform diff --git a/src/CreeDictionary/CreeDictionary/templatetags/relabelling.py b/src/CreeDictionary/CreeDictionary/templatetags/relabelling.py index 98c35c109..239ef5b3e 100644 --- a/src/CreeDictionary/CreeDictionary/templatetags/relabelling.py +++ b/src/CreeDictionary/CreeDictionary/templatetags/relabelling.py @@ -10,7 +10,7 @@ from morphodict.relabelling import read_labels from CreeDictionary.morphodict.templatetags.morphodict_orth import orth_tag -from CreeDictionary.utils.types import FSTTag +from morphodict.utils.types import FSTTag from crkeng.app.preferences import DisplayMode logger = logging.getLogger(__name__) diff --git a/src/CreeDictionary/CreeDictionary/utils.py b/src/CreeDictionary/CreeDictionary/utils.py index 55c55ac18..5277bb538 100644 --- a/src/CreeDictionary/CreeDictionary/utils.py +++ b/src/CreeDictionary/CreeDictionary/utils.py @@ -5,21 +5,3 @@ Utilities that depend on the CreeDictionary Django application. """ -from urllib.parse import ParseResult, urlencode, urlunparse - -from django.urls import reverse - - -def url_for_query(user_query: str) -> str: - """ - Produces a relative URL to search for the given user query. - """ - parts = ParseResult( - scheme="", - netloc="", - params="", - path=reverse("cree-dictionary-search"), - query=urlencode((("q", user_query),)), - fragment="", - ) - return urlunparse(parts) diff --git a/src/CreeDictionary/CreeDictionary/views.py b/src/CreeDictionary/CreeDictionary/views.py index 541cf4c55..a86fc62f2 100644 --- a/src/CreeDictionary/CreeDictionary/views.py +++ b/src/CreeDictionary/CreeDictionary/views.py @@ -27,7 +27,7 @@ from .paradigm.manager import ParadigmDoesNotExistError from .paradigm.panes import Paradigm, WordformCell -from .utils import url_for_query +from morphodict.utils import url_for_query # The index template expects to be rendered in the following "modes"; # The mode dictates which variables MUST be present in the context. diff --git a/src/CreeDictionary/morphodict/paradigms.py b/src/CreeDictionary/morphodict/paradigms.py index 9191d4dd3..350977c18 100644 --- a/src/CreeDictionary/morphodict/paradigms.py +++ b/src/CreeDictionary/morphodict/paradigms.py @@ -1,2 +1,2 @@ -# todo: +1# todo: # define a specification that other language specific apps implement to produce paradigms. diff --git a/src/CreeDictionary/phrase_translate/translate.py b/src/CreeDictionary/phrase_translate/translate.py index b6df3cb4e..a9a5ffa32 100755 --- a/src/CreeDictionary/phrase_translate/translate.py +++ b/src/CreeDictionary/phrase_translate/translate.py @@ -41,7 +41,7 @@ verb_wordform_to_phrase, ) -from CreeDictionary.utils.shared_res_dir import shared_fst_dir +from morphodict.utils.shared_res_dir import shared_fst_dir logger = logging.getLogger(__name__) diff --git a/src/morphodict/lexicon/management/commands/importjsondict.py b/src/morphodict/lexicon/management/commands/importjsondict.py index d069ce42f..5090502d5 100644 --- a/src/morphodict/lexicon/management/commands/importjsondict.py +++ b/src/morphodict/lexicon/management/commands/importjsondict.py @@ -22,7 +22,7 @@ translate_single_definition, TranslationStats, ) -from CreeDictionary.utils.english_keyword_extraction import stem_keywords +from morphodict.utils.english_keyword_extraction import stem_keywords from morphodict.analysis import RichAnalysis, strict_generator from morphodict.lexicon import DEFAULT_IMPORTJSON_FILE from morphodict.lexicon.management.commands.buildtestimportjson import entry_sort_key diff --git a/src/morphodict/lexicon/models.py b/src/morphodict/lexicon/models.py index d32adc090..544830cb5 100644 --- a/src/morphodict/lexicon/models.py +++ b/src/morphodict/lexicon/models.py @@ -9,8 +9,8 @@ from django.urls import reverse from django.utils.functional import cached_property -from morphodict.search.serializer import SerializedDefinition -from CreeDictionary.utils import ( +from morphodict.utils.serializer import SerializedDefinition +from morphodict.utils import ( shared_res_dir, ) from morphodict.analysis import RichAnalysis diff --git a/src/morphodict/relabelling/__init__.py b/src/morphodict/relabelling/__init__.py index a9bd1d24a..f4a0b95e5 100644 --- a/src/morphodict/relabelling/__init__.py +++ b/src/morphodict/relabelling/__init__.py @@ -7,8 +7,8 @@ from django.conf import settings -from CreeDictionary.utils import shared_res_dir -from CreeDictionary.utils.types import FSTTag, Label, cast_away_optional +from morphodict.utils import shared_res_dir +from morphodict.utils.types import FSTTag, Label, cast_away_optional from morphodict.site.util import cache_unless diff --git a/src/CreeDictionary/res/CW_aggregate_morpheme_log_freqs.txt b/src/morphodict/resources/CW_aggregate_morpheme_log_freqs.txt similarity index 100% rename from src/CreeDictionary/res/CW_aggregate_morpheme_log_freqs.txt rename to src/morphodict/resources/CW_aggregate_morpheme_log_freqs.txt diff --git a/src/CreeDictionary/res/README.md b/src/morphodict/resources/README.md similarity index 100% rename from src/CreeDictionary/res/README.md rename to src/morphodict/resources/README.md diff --git a/src/CreeDictionary/res/W_aggr_corp_morph_log_freq.txt b/src/morphodict/resources/W_aggr_corp_morph_log_freq.txt similarity index 100% rename from src/CreeDictionary/res/W_aggr_corp_morph_log_freq.txt rename to src/morphodict/resources/W_aggr_corp_morph_log_freq.txt diff --git a/src/CreeDictionary/res/corpus_frequency.txt b/src/morphodict/resources/corpus_frequency.txt similarity index 100% rename from src/CreeDictionary/res/corpus_frequency.txt rename to src/morphodict/resources/corpus_frequency.txt diff --git a/src/CreeDictionary/res/crk.altlabel.tsv b/src/morphodict/resources/crk.altlabel.tsv similarity index 100% rename from src/CreeDictionary/res/crk.altlabel.tsv rename to src/morphodict/resources/crk.altlabel.tsv diff --git a/src/CreeDictionary/res/crk_glossaries_aggregate_vocab.txt b/src/morphodict/resources/crk_glossaries_aggregate_vocab.txt similarity index 100% rename from src/CreeDictionary/res/crk_glossaries_aggregate_vocab.txt rename to src/morphodict/resources/crk_glossaries_aggregate_vocab.txt diff --git a/src/CreeDictionary/res/fst/.gitattributes b/src/morphodict/resources/fst/.gitattributes similarity index 100% rename from src/CreeDictionary/res/fst/.gitattributes rename to src/morphodict/resources/fst/.gitattributes diff --git a/src/CreeDictionary/res/fst/transcriptor-cw-eng-noun-entry2inflected-phrase-w-flags.fomabin b/src/morphodict/resources/fst/transcriptor-cw-eng-noun-entry2inflected-phrase-w-flags.fomabin similarity index 100% rename from src/CreeDictionary/res/fst/transcriptor-cw-eng-noun-entry2inflected-phrase-w-flags.fomabin rename to src/morphodict/resources/fst/transcriptor-cw-eng-noun-entry2inflected-phrase-w-flags.fomabin diff --git a/src/CreeDictionary/res/fst/transcriptor-cw-eng-verb-entry2inflected-phrase-w-flags-and-templates.fomabin b/src/morphodict/resources/fst/transcriptor-cw-eng-verb-entry2inflected-phrase-w-flags-and-templates.fomabin similarity index 100% rename from src/CreeDictionary/res/fst/transcriptor-cw-eng-verb-entry2inflected-phrase-w-flags-and-templates.fomabin rename to src/morphodict/resources/fst/transcriptor-cw-eng-verb-entry2inflected-phrase-w-flags-and-templates.fomabin diff --git a/src/CreeDictionary/res/fst/transcriptor-cw-eng-verb-entry2inflected-phrase-w-flags.fomabin b/src/morphodict/resources/fst/transcriptor-cw-eng-verb-entry2inflected-phrase-w-flags.fomabin similarity index 100% rename from src/CreeDictionary/res/fst/transcriptor-cw-eng-verb-entry2inflected-phrase-w-flags.fomabin rename to src/morphodict/resources/fst/transcriptor-cw-eng-verb-entry2inflected-phrase-w-flags.fomabin diff --git a/src/CreeDictionary/res/fst/transcriptor-eng-phrase2crk-features.fomabin b/src/morphodict/resources/fst/transcriptor-eng-phrase2crk-features.fomabin similarity index 100% rename from src/CreeDictionary/res/fst/transcriptor-eng-phrase2crk-features.fomabin rename to src/morphodict/resources/fst/transcriptor-eng-phrase2crk-features.fomabin diff --git a/src/CreeDictionary/res/layouts/NA/basic.tsv b/src/morphodict/resources/layouts/NA/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NA/basic.tsv rename to src/morphodict/resources/layouts/NA/basic.tsv diff --git a/src/CreeDictionary/res/layouts/NA/full.tsv b/src/morphodict/resources/layouts/NA/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NA/full.tsv rename to src/morphodict/resources/layouts/NA/full.tsv diff --git a/src/CreeDictionary/res/layouts/NA_distr/basic.tsv b/src/morphodict/resources/layouts/NA_distr/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NA_distr/basic.tsv rename to src/morphodict/resources/layouts/NA_distr/basic.tsv diff --git a/src/CreeDictionary/res/layouts/NA_distr/full.tsv b/src/morphodict/resources/layouts/NA_distr/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NA_distr/full.tsv rename to src/morphodict/resources/layouts/NA_distr/full.tsv diff --git a/src/CreeDictionary/res/layouts/NA_loc/basic.tsv b/src/morphodict/resources/layouts/NA_loc/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NA_loc/basic.tsv rename to src/morphodict/resources/layouts/NA_loc/basic.tsv diff --git a/src/CreeDictionary/res/layouts/NA_loc/full.tsv b/src/morphodict/resources/layouts/NA_loc/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NA_loc/full.tsv rename to src/morphodict/resources/layouts/NA_loc/full.tsv diff --git a/src/CreeDictionary/res/layouts/NDA/basic.tsv b/src/morphodict/resources/layouts/NDA/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NDA/basic.tsv rename to src/morphodict/resources/layouts/NDA/basic.tsv diff --git a/src/CreeDictionary/res/layouts/NDA/full.tsv b/src/morphodict/resources/layouts/NDA/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NDA/full.tsv rename to src/morphodict/resources/layouts/NDA/full.tsv diff --git a/src/CreeDictionary/res/layouts/NDA_distr/basic.tsv b/src/morphodict/resources/layouts/NDA_distr/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NDA_distr/basic.tsv rename to src/morphodict/resources/layouts/NDA_distr/basic.tsv diff --git a/src/CreeDictionary/res/layouts/NDA_distr/full.tsv b/src/morphodict/resources/layouts/NDA_distr/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NDA_distr/full.tsv rename to src/morphodict/resources/layouts/NDA_distr/full.tsv diff --git a/src/CreeDictionary/res/layouts/NDA_loc/basic.tsv b/src/morphodict/resources/layouts/NDA_loc/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NDA_loc/basic.tsv rename to src/morphodict/resources/layouts/NDA_loc/basic.tsv diff --git a/src/CreeDictionary/res/layouts/NDA_loc/full.tsv b/src/morphodict/resources/layouts/NDA_loc/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NDA_loc/full.tsv rename to src/morphodict/resources/layouts/NDA_loc/full.tsv diff --git a/src/CreeDictionary/res/layouts/NDI/basic.tsv b/src/morphodict/resources/layouts/NDI/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NDI/basic.tsv rename to src/morphodict/resources/layouts/NDI/basic.tsv diff --git a/src/CreeDictionary/res/layouts/NDI/full.tsv b/src/morphodict/resources/layouts/NDI/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NDI/full.tsv rename to src/morphodict/resources/layouts/NDI/full.tsv diff --git a/src/CreeDictionary/res/layouts/NI/basic.tsv b/src/morphodict/resources/layouts/NI/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NI/basic.tsv rename to src/morphodict/resources/layouts/NI/basic.tsv diff --git a/src/CreeDictionary/res/layouts/NI/full.tsv b/src/morphodict/resources/layouts/NI/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/NI/full.tsv rename to src/morphodict/resources/layouts/NI/full.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/basic.tsv b/src/morphodict/resources/layouts/VAI/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/basic.tsv rename to src/morphodict/resources/layouts/VAI/basic.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/full.tsv b/src/morphodict/resources/layouts/VAI/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/full.tsv rename to src/morphodict/resources/layouts/VAI/full.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/revised/NA.tsv b/src/morphodict/resources/layouts/VAI/revised/NA.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/revised/NA.tsv rename to src/morphodict/resources/layouts/VAI/revised/NA.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/revised/NAD.tsv b/src/morphodict/resources/layouts/VAI/revised/NAD.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/revised/NAD.tsv rename to src/morphodict/resources/layouts/VAI/revised/NAD.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/revised/NI.tsv b/src/morphodict/resources/layouts/VAI/revised/NI.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/revised/NI.tsv rename to src/morphodict/resources/layouts/VAI/revised/NI.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/revised/NID.tsv b/src/morphodict/resources/layouts/VAI/revised/NID.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/revised/NID.tsv rename to src/morphodict/resources/layouts/VAI/revised/NID.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/revised/VAI.tsv b/src/morphodict/resources/layouts/VAI/revised/VAI.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/revised/VAI.tsv rename to src/morphodict/resources/layouts/VAI/revised/VAI.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/revised/VII.tsv b/src/morphodict/resources/layouts/VAI/revised/VII.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/revised/VII.tsv rename to src/morphodict/resources/layouts/VAI/revised/VII.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/revised/VTA.tsv b/src/morphodict/resources/layouts/VAI/revised/VTA.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/revised/VTA.tsv rename to src/morphodict/resources/layouts/VAI/revised/VTA.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/revised/VTI.tsv b/src/morphodict/resources/layouts/VAI/revised/VTI.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/revised/VTI.tsv rename to src/morphodict/resources/layouts/VAI/revised/VTI.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/revised/demonstrative-pronouns.tsv b/src/morphodict/resources/layouts/VAI/revised/demonstrative-pronouns.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/revised/demonstrative-pronouns.tsv rename to src/morphodict/resources/layouts/VAI/revised/demonstrative-pronouns.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/revised/personal-pronouns.tsv b/src/morphodict/resources/layouts/VAI/revised/personal-pronouns.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/revised/personal-pronouns.tsv rename to src/morphodict/resources/layouts/VAI/revised/personal-pronouns.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/NA.tsv b/src/morphodict/resources/layouts/VAI/test/NA.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/NA.tsv rename to src/morphodict/resources/layouts/VAI/test/NA.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/NAD.tsv b/src/morphodict/resources/layouts/VAI/test/NAD.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/NAD.tsv rename to src/morphodict/resources/layouts/VAI/test/NAD.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/NI.tsv b/src/morphodict/resources/layouts/VAI/test/NI.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/NI.tsv rename to src/morphodict/resources/layouts/VAI/test/NI.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/NID.tsv b/src/morphodict/resources/layouts/VAI/test/NID.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/NID.tsv rename to src/morphodict/resources/layouts/VAI/test/NID.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/VAI.tsv b/src/morphodict/resources/layouts/VAI/test/VAI.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/VAI.tsv rename to src/morphodict/resources/layouts/VAI/test/VAI.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/VII.tsv b/src/morphodict/resources/layouts/VAI/test/VII.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/VII.tsv rename to src/morphodict/resources/layouts/VAI/test/VII.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/VTA.tsv b/src/morphodict/resources/layouts/VAI/test/VTA.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/VTA.tsv rename to src/morphodict/resources/layouts/VAI/test/VTA.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/VTI.tsv b/src/morphodict/resources/layouts/VAI/test/VTI.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/VTI.tsv rename to src/morphodict/resources/layouts/VAI/test/VTI.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/demonstrative-pronouns.tsv b/src/morphodict/resources/layouts/VAI/test/demonstrative-pronouns.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/demonstrative-pronouns.tsv rename to src/morphodict/resources/layouts/VAI/test/demonstrative-pronouns.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/panes2.tsv b/src/morphodict/resources/layouts/VAI/test/panes2.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/panes2.tsv rename to src/morphodict/resources/layouts/VAI/test/panes2.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/personal-pronouns.tsv b/src/morphodict/resources/layouts/VAI/test/personal-pronouns.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/personal-pronouns.tsv rename to src/morphodict/resources/layouts/VAI/test/personal-pronouns.tsv diff --git a/src/CreeDictionary/res/layouts/VAI/test/renderings.tsv b/src/morphodict/resources/layouts/VAI/test/renderings.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VAI/test/renderings.tsv rename to src/morphodict/resources/layouts/VAI/test/renderings.tsv diff --git a/src/CreeDictionary/res/layouts/VII/basic.tsv b/src/morphodict/resources/layouts/VII/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VII/basic.tsv rename to src/morphodict/resources/layouts/VII/basic.tsv diff --git a/src/CreeDictionary/res/layouts/VII/full.tsv b/src/morphodict/resources/layouts/VII/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VII/full.tsv rename to src/morphodict/resources/layouts/VII/full.tsv diff --git a/src/CreeDictionary/res/layouts/VTA/basic.tsv b/src/morphodict/resources/layouts/VTA/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VTA/basic.tsv rename to src/morphodict/resources/layouts/VTA/basic.tsv diff --git a/src/CreeDictionary/res/layouts/VTA/full.tsv b/src/morphodict/resources/layouts/VTA/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VTA/full.tsv rename to src/morphodict/resources/layouts/VTA/full.tsv diff --git a/src/CreeDictionary/res/layouts/VTI/basic.tsv b/src/morphodict/resources/layouts/VTI/basic.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VTI/basic.tsv rename to src/morphodict/resources/layouts/VTI/basic.tsv diff --git a/src/CreeDictionary/res/layouts/VTI/full.tsv b/src/morphodict/resources/layouts/VTI/full.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/VTI/full.tsv rename to src/morphodict/resources/layouts/VTI/full.tsv diff --git a/src/CreeDictionary/res/layouts/demonstrative-pronouns.tsv b/src/morphodict/resources/layouts/demonstrative-pronouns.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/demonstrative-pronouns.tsv rename to src/morphodict/resources/layouts/demonstrative-pronouns.tsv diff --git a/src/CreeDictionary/res/layouts/personal-pronouns.tsv b/src/morphodict/resources/layouts/personal-pronouns.tsv similarity index 100% rename from src/CreeDictionary/res/layouts/personal-pronouns.tsv rename to src/morphodict/resources/layouts/personal-pronouns.tsv diff --git a/src/CreeDictionary/res/lemma_frequency.txt b/src/morphodict/resources/lemma_frequency.txt similarity index 100% rename from src/CreeDictionary/res/lemma_frequency.txt rename to src/morphodict/resources/lemma_frequency.txt diff --git a/src/CreeDictionary/res/lemma_tags/README.md b/src/morphodict/resources/lemma_tags/README.md similarity index 100% rename from src/CreeDictionary/res/lemma_tags/README.md rename to src/morphodict/resources/lemma_tags/README.md diff --git a/src/CreeDictionary/res/lemma_tags/crk/lemma-tags.tsv b/src/morphodict/resources/lemma_tags/crk/lemma-tags.tsv similarity index 100% rename from src/CreeDictionary/res/lemma_tags/crk/lemma-tags.tsv rename to src/morphodict/resources/lemma_tags/crk/lemma-tags.tsv diff --git a/src/morphodict/search/affix.py b/src/morphodict/search/affix.py index 78d1dedcb..4e3bd97b6 100644 --- a/src/morphodict/search/affix.py +++ b/src/morphodict/search/affix.py @@ -18,8 +18,8 @@ from django.conf import settings from morphodict.lexicon.models import Wordform, TargetLanguageKeyword -from CreeDictionary.utils import get_modified_distance -from CreeDictionary.utils.cree_lev_dist import remove_cree_diacritics +from morphodict.utils import get_modified_distance +from morphodict.utils.cree_lev_dist import remove_cree_diacritics from morphodict.lexicon.util import to_source_language_keyword from .types import ( InternalForm, diff --git a/src/morphodict/search/glossary_count.py b/src/morphodict/search/glossary_count.py index 67dfa0301..00760a1a6 100644 --- a/src/morphodict/search/glossary_count.py +++ b/src/morphodict/search/glossary_count.py @@ -1,6 +1,6 @@ from pathlib import Path -from CreeDictionary.utils import shared_res_dir +from morphodict.utils import shared_res_dir DOCUMENT_FREQUENCY = {} diff --git a/src/morphodict/search/lemma_freq.py b/src/morphodict/search/lemma_freq.py index bd3b2ac2f..5dd74013a 100644 --- a/src/morphodict/search/lemma_freq.py +++ b/src/morphodict/search/lemma_freq.py @@ -1,6 +1,6 @@ from pathlib import Path -from CreeDictionary.utils import shared_res_dir +from morphodict.utils import shared_res_dir LEMMA_FREQUENCY = {} diff --git a/src/morphodict/search/lookup.py b/src/morphodict/search/lookup.py index 4d56806c5..23172f04c 100644 --- a/src/morphodict/search/lookup.py +++ b/src/morphodict/search/lookup.py @@ -4,10 +4,10 @@ from django.db.models import Q -from CreeDictionary.utils import ( +from morphodict.utils import ( get_modified_distance, ) -from CreeDictionary.utils.english_keyword_extraction import stem_keywords +from morphodict.utils.english_keyword_extraction import stem_keywords from morphodict.analysis import ( strict_generator, rich_analyze_relaxed, diff --git a/src/morphodict/search/presentation.py b/src/morphodict/search/presentation.py index dedc8ed80..f170f3ccb 100644 --- a/src/morphodict/search/presentation.py +++ b/src/morphodict/search/presentation.py @@ -9,10 +9,9 @@ from morphodict.search import core, types from morphodict.relabelling import read_labels, LABELS -from CreeDictionary.utils import get_modified_distance -from CreeDictionary.utils.fst_analysis_parser import partition_analysis +from morphodict.utils.fst_analysis_parser import partition_analysis from morphodict.search.types import Preverb, LinguisticTag, linguistic_tag_from_fst_tags -from CreeDictionary.utils.types import ConcatAnalysis, FSTTag, Label +from morphodict.utils.types import ConcatAnalysis, FSTTag, Label from crkeng.app.preferences import ( DisplayMode, AnimateEmoji, @@ -22,7 +21,7 @@ from morphodict.analysis import RichAnalysis from morphodict.lexicon.models import Wordform, SourceLanguageKeyword -from morphodict.search.serializer import ( +from morphodict.utils.serializer import ( SerializedDefinition, SerializedWordform, SerializedLinguisticTag, diff --git a/src/morphodict/search/runner.py b/src/morphodict/search/runner.py index da788f337..416176c78 100644 --- a/src/morphodict/search/runner.py +++ b/src/morphodict/search/runner.py @@ -17,7 +17,7 @@ from morphodict.search.query import CvdSearchType from morphodict.search.types import Result from morphodict.search.util import first_non_none_value -from CreeDictionary.utils.types import cast_away_optional +from morphodict.utils.types import cast_away_optional CREE_LONG_VOWEL = re.compile("[êîôâēīōā]") diff --git a/src/morphodict/search/types.py b/src/morphodict/search/types.py index 5f7cffe7f..10a3f7b84 100644 --- a/src/morphodict/search/types.py +++ b/src/morphodict/search/types.py @@ -6,8 +6,8 @@ from enum import Enum from typing import NewType, Optional, Protocol, cast, Iterable, Tuple -from morphodict.search.serializer import SerializedLinguisticTag -from CreeDictionary.utils.types import FSTTag, Label +from morphodict.utils.serializer import SerializedLinguisticTag +from morphodict.utils.types import FSTTag, Label from morphodict.lexicon.models import Wordform, wordform_cache from morphodict.search import ranking from morphodict.relabelling import LABELS diff --git a/src/morphodict/search_quality/__init__.py b/src/morphodict/search_quality/__init__.py index 88c0f3269..f624932ba 100644 --- a/src/morphodict/search_quality/__init__.py +++ b/src/morphodict/search_quality/__init__.py @@ -1,7 +1,7 @@ from pathlib import Path from typing import TypedDict -from morphodict.search.serializer import SerializedSearchResult +from morphodict.utils.serializer import SerializedSearchResult class SearchResult(TypedDict): diff --git a/src/morphodict/search_quality/analyze_results.py b/src/morphodict/search_quality/analyze_results.py index 81c3b5098..f344a1654 100644 --- a/src/morphodict/search_quality/analyze_results.py +++ b/src/morphodict/search_quality/analyze_results.py @@ -10,7 +10,7 @@ from os import PathLike from typing import cast, TypedDict, Optional -from morphodict.search.serializer import SerializedSearchResult +from morphodict.utils.serializer import SerializedSearchResult from . import DEFAULT_SAMPLE_FILE, SampleSearchResultsJson from .sample import load_sample_definition, SampleDefinition diff --git a/src/morphodict/tests/test_utils.py b/src/morphodict/tests/test_utils.py index 3251c3996..c78074160 100644 --- a/src/morphodict/tests/test_utils.py +++ b/src/morphodict/tests/test_utils.py @@ -1,7 +1,7 @@ from string import printable as ascii_printable import pytest -from CreeDictionary.CreeDictionary.utils import url_for_query +from morphodict.utils import url_for_query @pytest.mark.parametrize("query", ["awa", "wâpamêw", "ᐚᐸᒣᐤ"]) diff --git a/src/morphodict/tests/utils_tests/test_cree_lev_dist.py b/src/morphodict/tests/utils_tests/test_cree_lev_dist.py index 8f545b10d..e6d78d852 100644 --- a/src/morphodict/tests/utils_tests/test_cree_lev_dist.py +++ b/src/morphodict/tests/utils_tests/test_cree_lev_dist.py @@ -4,7 +4,7 @@ from hypothesis import assume, example, given from hypothesis.strategies import text from Levenshtein import distance -from CreeDictionary.utils import get_modified_distance +from morphodict.utils import get_modified_distance @given(text(alphabet=ascii_letters), text(alphabet=ascii_letters)) diff --git a/src/morphodict/tests/utils_tests/test_profiling.py b/src/morphodict/tests/utils_tests/test_profiling.py index b41f7cd29..7dab57a50 100644 --- a/src/morphodict/tests/utils_tests/test_profiling.py +++ b/src/morphodict/tests/utils_tests/test_profiling.py @@ -1,6 +1,6 @@ import time -from CreeDictionary.utils.profiling import timed +from morphodict.utils.profiling import timed def test_timed_decorator(capsys): diff --git a/src/morphodict/utils/__init__.py b/src/morphodict/utils/__init__.py index b11076a35..3c4e3bced 100644 --- a/src/morphodict/utils/__init__.py +++ b/src/morphodict/utils/__init__.py @@ -1,2 +1,20 @@ from .cree_lev_dist import get_modified_distance from .shared_res_dir import shared_res_dir +from urllib.parse import ParseResult, urlencode, urlunparse + +from django.urls import reverse + + +def url_for_query(user_query: str) -> str: + """ + Produces a relative URL to search for the given user query. + """ + parts = ParseResult( + scheme="", + netloc="", + params="", + path=reverse("cree-dictionary-search"), + query=urlencode((("q", user_query),)), + fragment="", + ) + return urlunparse(parts) diff --git a/src/morphodict/utils/fst_analysis_parser.py b/src/morphodict/utils/fst_analysis_parser.py index e155c5ac8..989db32f2 100644 --- a/src/morphodict/utils/fst_analysis_parser.py +++ b/src/morphodict/utils/fst_analysis_parser.py @@ -1,7 +1,7 @@ import re from typing import List, Tuple -from CreeDictionary.utils.types import FSTLemma, FSTTag +from morphodict.utils.types import FSTLemma, FSTTag analysis_pattern = re.compile( r"(?P\+N\+A(\+D(?=\+))?|\+N\+I(\+D(?=\+))?|\+V\+AI|\+V\+T[AI]|\+V\+II|(\+Num)?\+Ipc|\+Pron).*?$" diff --git a/src/morphodict/utils/serializer.py b/src/morphodict/utils/serializer.py index cbfeaaa35..ad8e736e1 100644 --- a/src/morphodict/utils/serializer.py +++ b/src/morphodict/utils/serializer.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, TypedDict -from CreeDictionary.utils.types import FSTTag +from morphodict.utils.types import FSTTag class SerializedDefinition(TypedDict): diff --git a/src/morphodict/utils/shared_res_dir.py b/src/morphodict/utils/shared_res_dir.py index d7dbd6c67..8b168a0e2 100644 --- a/src/morphodict/utils/shared_res_dir.py +++ b/src/morphodict/utils/shared_res_dir.py @@ -4,6 +4,6 @@ from pathlib import Path -shared_res_dir: Path = Path(__file__).parent.parent / "res" +shared_res_dir: Path = Path(__file__).parent.parent / "resources" shared_fst_dir = shared_res_dir / "fst"