From 8d8d06af9f0d5a1650c32a84f3d0dd676c4c5dd5 Mon Sep 17 00:00:00 2001 From: Cesar Del Solar Date: Tue, 23 Apr 2019 22:02:54 -0400 Subject: [PATCH] fixing polish dictionary to be OSPS40 --- djAerolith/accounts/models.py | 2 ++ djAerolith/base/models.py | 7 +++---- djAerolith/djaerolith/settings.py | 1 + djAerolith/flashcards/templates/flashcards/index.html | 1 + djAerolith/wordwalls/fixtures/test/lexica.yaml | 4 ++-- djAerolith/wordwalls/management/commands/genNamedLists.py | 3 ++- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/djAerolith/accounts/models.py b/djAerolith/accounts/models.py index 1c564463..1389ae45 100644 --- a/djAerolith/accounts/models.py +++ b/djAerolith/accounts/models.py @@ -31,6 +31,8 @@ def getLexicon(request=None): return Lexicon.objects.get(lexiconName='NWL18') elif request.LANGUAGE_CODE == 'es': return Lexicon.objects.get(lexiconName='FISE2') + elif request.LANGUAGE_CODE == 'pl': + return Lexicon.objects.get(lexiconName='OSPS40') return Lexicon.objects.get(lexiconName='NWL18') diff --git a/djAerolith/base/models.py b/djAerolith/base/models.py index f5b1869e..f8b517d9 100644 --- a/djAerolith/base/models.py +++ b/djAerolith/base/models.py @@ -36,10 +36,9 @@ 'America', ] -# XXX: This handles both the Spanish and English case, but alphagrammize -# will need to be reworked with lexicon-specific ordering if we add -# non-latin letters. -SORT_STRING_ORDER = 'ABC1DEFGHIJKL2MNÑOPQR3STUVWXYZ?' +# XXX: This handles Spanish, English and Polish. It is pretty ghetto. +# Consider reworking with lexicon-specific reordering (see macondo e.g.) +SORT_STRING_ORDER = 'AĄBCĆ1DEĘFGHIJKLŁ2MNŃÑOÓPQR3SŚTUVWXYZŹŻ?' SORT_MAP = {} diff --git a/djAerolith/djaerolith/settings.py b/djAerolith/djaerolith/settings.py index c4831f9c..9b988262 100644 --- a/djAerolith/djaerolith/settings.py +++ b/djAerolith/djaerolith/settings.py @@ -75,6 +75,7 @@ def tobool(val): LANGUAGES = [ ('en', _('English')), ('es', _('Spanish')), + ('pl', _('Polish')), ] SITE_ID = 1 diff --git a/djAerolith/flashcards/templates/flashcards/index.html b/djAerolith/flashcards/templates/flashcards/index.html index 6378456a..77e4ffed 100644 --- a/djAerolith/flashcards/templates/flashcards/index.html +++ b/djAerolith/flashcards/templates/flashcards/index.html @@ -105,6 +105,7 @@ + diff --git a/djAerolith/wordwalls/fixtures/test/lexica.yaml b/djAerolith/wordwalls/fixtures/test/lexica.yaml index 38ca511f..66c7279e 100644 --- a/djAerolith/wordwalls/fixtures/test/lexica.yaml +++ b/djAerolith/wordwalls/fixtures/test/lexica.yaml @@ -47,8 +47,8 @@ model: base.lexicon pk: 10 - fields: - lengthCounts: '{"10":287145,"11":327427,"12":336526,"13":318775,"14":281324,"15":229153,"2":100,"3":1107,"4":5194,"5":17853,"6":43367,"7":89363,"8":153158,"9":224471}' + lengthCounts: '{"10":290522,"11":331232,"12":339846,"13":321838,"14":283230,"15":230698,"2":100,"3":1107,"4":5198,"5":17913,"6":43642,"7":90127,"8":155129,"9":227533}' lexiconDescription: "Polska Federacja Scrabble - Update 38" - lexiconName: OSPS38 + lexiconName: OSPS40 model: base.lexicon pk: 11 \ No newline at end of file diff --git a/djAerolith/wordwalls/management/commands/genNamedLists.py b/djAerolith/wordwalls/management/commands/genNamedLists.py index ef1a814e..668fcfd1 100644 --- a/djAerolith/wordwalls/management/commands/genNamedLists.py +++ b/djAerolith/wordwalls/management/commands/genNamedLists.py @@ -284,7 +284,7 @@ def create_spanish_lists(): def create_polish_lists(): - lex = Lexicon.objects.get(lexiconName='OSPS38') + lex = Lexicon.objects.get(lexiconName='OSPS40') db = WordDB(lex.lexiconName) for i in range(2, 16): logger.debug('Creating WL for lex %s, length %s', lex.lexiconName, i) @@ -356,4 +356,5 @@ def handle(self, **options): # lexiconName__in=['NWL18']): # createNamedLists(lex) # create_spanish_lists() + NamedList.objects.filter(lexicon__lexiconName='OSPS40').delete() create_polish_lists()