From 1e04c8f31d22c8a68f52d5376eeca8edae450cda Mon Sep 17 00:00:00 2001
From: Cesar Del Solar
Date: Fri, 8 Feb 2019 23:31:58 -0500
Subject: [PATCH 1/4] adding new lexica
---
djAerolith/accounts/models.py | 6 ++--
djAerolith/base/models.py | 2 ++
.../js/flashcards/templates/new_quiz.html | 3 +-
.../js/flashcards/views/word_search_form.jsx | 6 ++--
.../templates/flashcards/index.html | 3 +-
djAerolith/lib/word_searches.py | 14 +++++---
.../wordwalls/fixtures/test/lexica.json | 18 +++++++++++
.../management/commands/genNamedLists.py | 32 ++++++-------------
.../js/wordwalls/newtable/search/types.js | 4 +--
.../js/wordwalls/newtable/table_creator.jsx | 18 ++++++++++-
.../js/wordwalls/wordwalls_app_container.jsx | 2 +-
.../static/js/wordwalls/wordwalls_game.js | 2 +-
djAerolith/wordwalls/stats.py | 4 +--
.../wordwalls/templates/wordwalls/stats.html | 4 +--
14 files changed, 75 insertions(+), 43 deletions(-)
diff --git a/djAerolith/accounts/models.py b/djAerolith/accounts/models.py
index b097ee92..1c564463 100644
--- a/djAerolith/accounts/models.py
+++ b/djAerolith/accounts/models.py
@@ -28,10 +28,10 @@
def getLexicon(request=None):
if not request:
- return Lexicon.objects.get(lexiconName='America')
+ return Lexicon.objects.get(lexiconName='NWL18')
elif request.LANGUAGE_CODE == 'es':
- return Lexicon.objects.get(lexiconName='FISE09')
- return Lexicon.objects.get(lexiconName='America')
+ return Lexicon.objects.get(lexiconName='FISE2')
+ return Lexicon.objects.get(lexiconName='NWL18')
class AerolithProfile(models.Model):
diff --git a/djAerolith/base/models.py b/djAerolith/base/models.py
index 05e3a3cf..268f592e 100644
--- a/djAerolith/base/models.py
+++ b/djAerolith/base/models.py
@@ -32,6 +32,8 @@
'CSW07',
'CSW12',
'America2016',
+ 'FISE09',
+ # 'America' # Remove this lexicon sometime in March.
]
# XXX: This handles both the Spanish and English case, but alphagrammize
diff --git a/djAerolith/flashcards/static/js/flashcards/templates/new_quiz.html b/djAerolith/flashcards/static/js/flashcards/templates/new_quiz.html
index 950ea30f..45410780 100644
--- a/djAerolith/flashcards/static/js/flashcards/templates/new_quiz.html
+++ b/djAerolith/flashcards/static/js/flashcards/templates/new_quiz.html
@@ -24,8 +24,9 @@
diff --git a/djAerolith/flashcards/static/js/flashcards/views/word_search_form.jsx b/djAerolith/flashcards/static/js/flashcards/views/word_search_form.jsx
index a44eac32..a309d9a4 100644
--- a/djAerolith/flashcards/static/js/flashcards/views/word_search_form.jsx
+++ b/djAerolith/flashcards/static/js/flashcards/views/word_search_form.jsx
@@ -25,8 +25,8 @@ const allowedSearchTypes = new Set([
]);
const lexOptions = [{
- value: 'America',
- displayValue: 'America',
+ value: 'NWL18',
+ displayValue: 'NWL18',
}, {
value: 'CSW15',
displayValue: 'CSW15',
@@ -38,7 +38,7 @@ class WordSearchForm extends React.Component {
this.searchSubmit = this.searchSubmit.bind(this);
this.state = {
- lexicon: 'America',
+ lexicon: 'NWL18',
};
}
diff --git a/djAerolith/flashcards/templates/flashcards/index.html b/djAerolith/flashcards/templates/flashcards/index.html
index ca8bcdd5..6378456a 100644
--- a/djAerolith/flashcards/templates/flashcards/index.html
+++ b/djAerolith/flashcards/templates/flashcards/index.html
@@ -102,8 +102,9 @@ Look up Word
diff --git a/djAerolith/lib/word_searches.py b/djAerolith/lib/word_searches.py
index 8b1c1207..3ae1b02e 100644
--- a/djAerolith/lib/word_searches.py
+++ b/djAerolith/lib/word_searches.py
@@ -166,15 +166,21 @@ def temporary_list_name(search_descriptions, lexicon_name):
elif sd['condition'] == SearchDescription.NOT_IN_LEXICON:
desc = ''
if sd['lexicon'] == 'other_english':
- if lexicon_name == 'America':
+ if lexicon_name == 'NWL18':
desc = 'CSW15'
elif lexicon_name == 'CSW15':
- desc = 'America'
+ desc = 'NWL18'
+ # XXX: REMOVE IN MARCH
+ elif lexicon_name == 'America':
+ desc = 'CSW15'
elif sd['lexicon'] == 'update':
- if lexicon_name == 'America':
- desc = 'OWL2'
+ if lexicon_name == 'NWL18':
+ desc = 'America'
elif lexicon_name == 'CSW15':
desc = 'CSW12'
+ # XXX: REMOVE IN MARCH
+ elif lexicon_name == 'America':
+ desc = 'OWL2'
tokens.append(f'not in {desc}')
elif sd['condition'] == SearchDescription.MATCHING_ANAGRAM:
tokens.append(f'matching {sd["letters"]}')
diff --git a/djAerolith/wordwalls/fixtures/test/lexica.json b/djAerolith/wordwalls/fixtures/test/lexica.json
index 2aaed30d..2131d02e 100644
--- a/djAerolith/wordwalls/fixtures/test/lexica.json
+++ b/djAerolith/wordwalls/fixtures/test/lexica.json
@@ -52,5 +52,23 @@
},
"model": "base.lexicon",
"pk": 8
+},
+{
+ "fields": {
+ "lexiconDescription": "NASPA Word List 2018 Edition",
+ "lengthCounts": "{\"2\":75,\"3\":411,\"4\":2030,\"5\":7204,\"6\":16339,\"7\":32154,\"8\":50756,\"9\":68345,\"10\":79948,\"11\":76024,\"12\":62015,\"13\":43101,\"14\":25338,\"15\":12788}",
+ "lexiconName": "NWL18"
+ },
+ "model": "base.lexicon",
+ "pk": 9
+},
+{
+ "fields": {
+ "lexiconDescription": "Federación Internacional de Scrabble en Español, 2017 Edition",
+ "lengthCounts": "{\"2\":75,\"3\":411,\"4\":2030,\"5\":7204,\"6\":16339,\"7\":32154,\"8\":50756,\"9\":68345,\"10\":79948,\"11\":76024,\"12\":62015,\"13\":43101,\"14\":25338,\"15\":12788}",
+ "lexiconName": "FISE2"
+ },
+ "model": "base.lexicon",
+ "pk": 10
}
]
\ No newline at end of file
diff --git a/djAerolith/wordwalls/management/commands/genNamedLists.py b/djAerolith/wordwalls/management/commands/genNamedLists.py
index 0659e1ed..7f157c62 100644
--- a/djAerolith/wordwalls/management/commands/genNamedLists.py
+++ b/djAerolith/wordwalls/management/commands/genNamedLists.py
@@ -142,14 +142,14 @@ def create_wl_lists(i, lex, db):
create_named_list(lex, len(qs), i, False, json.dumps(qs),
'Eights with 5 or more vowels')
- if lex.lexiconName == 'America':
+ if lex.lexiconName == 'NWL18':
qs = get_questions_by_condition(
db, min_prob, max_prob, i,
lambda w: ('+' in w.lexicon_symbols),
condition_type=Condition.WORD)
create_named_list(
lex, len(qs), i, False, json.dumps(qs),
- 'America {} not in OWL2'.format(friendly_number_map[i]))
+ 'NWL18 {} not in America'.format(friendly_number_map[i]))
qs = get_questions_by_condition(
db, min_prob, max_prob, i,
@@ -157,7 +157,7 @@ def create_wl_lists(i, lex, db):
condition_type=Condition.WORD)
create_named_list(
lex, len(qs), i, False, json.dumps(qs),
- 'America {} not in CSW15'.format(friendly_number_map[i]))
+ 'NWL18 {} not in CSW15'.format(friendly_number_map[i]))
if i == 4:
qs = get_questions_by_condition(
@@ -168,7 +168,7 @@ def create_wl_lists(i, lex, db):
condition_type=Condition.WORD)
create_named_list(
lex, len(qs), i, False, json.dumps(qs),
- 'America JQXZ 4s not in OWL2')
+ 'NWL18 JQXZ 4s not in America')
elif i == 5:
qs = get_questions_by_condition(
db, min_prob, max_prob, i,
@@ -178,7 +178,7 @@ def create_wl_lists(i, lex, db):
condition_type=Condition.WORD)
create_named_list(
lex, len(qs), i, False, json.dumps(qs),
- 'America JQXZ 5s not in OWL2')
+ 'NWL18 JQXZ 5s not in America')
elif i == 6:
qs = get_questions_by_condition(
@@ -189,15 +189,7 @@ def create_wl_lists(i, lex, db):
condition_type=Condition.WORD)
create_named_list(
lex, len(qs), i, False, json.dumps(qs),
- 'America JQXZ 6s not in OWL2')
-
- qs = get_questions_by_condition(
- db, min_prob, max_prob, i,
- lambda w: ('%' in w.lexicon_symbols),
- condition_type=Condition.WORD)
- create_named_list(
- lex, len(qs), i, False, json.dumps(qs),
- 'America {} added in 2016'.format(friendly_number_map[i]))
+ 'NWL18 JQXZ 6s not in America')
if lex.lexiconName == 'CSW15':
qs = get_questions_by_condition(
@@ -214,7 +206,7 @@ def create_wl_lists(i, lex, db):
condition_type=Condition.WORD)
create_named_list(
lex, len(qs), i, False, json.dumps(qs),
- 'CSW15 {} not in America'.format(friendly_number_map[i]))
+ 'CSW15 {} not in NWL18'.format(friendly_number_map[i]))
def createNamedLists(lex):
@@ -232,7 +224,7 @@ def createNamedLists(lex):
def create_spanish_lists():
- lex = Lexicon.objects.get(lexiconName='FISE09')
+ lex = Lexicon.objects.get(lexiconName='FISE2')
db = WordDB(lex.lexiconName)
for i in range(2, 16):
logger.debug('Creating WL for lex %s, length %s', lex.lexiconName, i)
@@ -320,12 +312,8 @@ class Command(BaseCommand):
help = """Populates database with named lists"""
def handle_noargs(self, **options):
- NamedList.objects.filter(lexicon__lexiconName='America').delete()
- createNamedLists(Lexicon.objects.get(lexiconName='America'))
- return
-
- NamedList.objects.all().delete()
+ NamedList.objects.filter(lexicon__lexiconName='CSW15').delete()
for lex in Lexicon.objects.filter(
- lexiconName__in=['America', 'CSW2015']):
+ lexiconName__in=['NWL18', 'CSW15']):
createNamedLists(lex)
create_spanish_lists()
diff --git a/djAerolith/wordwalls/static/js/wordwalls/newtable/search/types.js b/djAerolith/wordwalls/static/js/wordwalls/newtable/search/types.js
index bb238d1b..a03da84e 100644
--- a/djAerolith/wordwalls/static/js/wordwalls/newtable/search/types.js
+++ b/djAerolith/wordwalls/static/js/wordwalls/newtable/search/types.js
@@ -125,8 +125,8 @@ const SearchTypesEnum = {
],
description: `Only looks for words that are NOT in the selected lexicon.
The "other English-language lexicon" refers to CSW15 if you are currently
- using the America lexicon, and America if you are currently using the
- CSW15 lexicon. The "last version" refers to OWL2 and CSW12, respectively.`,
+ using the NWL18 lexicon, and NWL18 if you are currently using the
+ CSW15 lexicon. The "last version" refers to America and CSW12, respectively.`,
},
11: {
name: 'probability_limit',
diff --git a/djAerolith/wordwalls/static/js/wordwalls/newtable/table_creator.jsx b/djAerolith/wordwalls/static/js/wordwalls/newtable/table_creator.jsx
index 042ee9f2..eac5ea2f 100644
--- a/djAerolith/wordwalls/static/js/wordwalls/newtable/table_creator.jsx
+++ b/djAerolith/wordwalls/static/js/wordwalls/newtable/table_creator.jsx
@@ -29,9 +29,14 @@ const NO_LOAD_WHILE_PLAYING = (
'Please wait until the end of the game to perform that action.');
const COLLINS_LEX_ID = 1;
+const NWL18_LEX_ID = 9;
const COLLINS_LICENSE_TEXT = `
The Collins Official Scrabble Words 2015 (CSW15) is copyright of
HarperCollins Publishers 2015 and used with permission.`;
+const NASPA_LICENSE_TEXT = `
+The NASPA Word List, 2018 Edition (NWL18) is copyright of the North
+American Scrabble Players Association (© 2019) and used with permission.`;
+
const DEFAULT_TIME_PER_QUIZ = '5'; // minutes
const DEFAULT_TIME_PER_BLANK_QUIZ = '10';
@@ -345,6 +350,17 @@ class TableCreator extends React.Component {
}
}
+ renderLicenseText() {
+ switch (this.state.currentLexicon) {
+ case COLLINS_LEX_ID:
+ return ({COLLINS_LICENSE_TEXT}
);
+ case NWL18_LEX_ID:
+ return ({NASPA_LICENSE_TEXT}
);
+ default:
+ return null;
+ }
+ }
+
renderQuizSearch() {
let selectedQuizSearchDialog;
switch (this.state.activeListType) {
@@ -508,7 +524,7 @@ class TableCreator extends React.Component {
{this.state.currentLexicon === COLLINS_LEX_ID ? COLLINS_LICENSE_TEXT : ''}
+ >{this.renderLicenseText()}
diff --git a/djAerolith/wordwalls/static/js/wordwalls/wordwalls_app_container.jsx b/djAerolith/wordwalls/static/js/wordwalls/wordwalls_app_container.jsx
index dd99598f..f8032a91 100644
--- a/djAerolith/wordwalls/static/js/wordwalls/wordwalls_app_container.jsx
+++ b/djAerolith/wordwalls/static/js/wordwalls/wordwalls_app_container.jsx
@@ -377,7 +377,7 @@ class WordwallsAppContainer extends React.Component {
// octothorp symbol.
let newGuess = guess.replace(/[^A-Za-zÑñ#]/g, '');
- if (this.state.lexicon !== 'FISE09') {
+ if (this.state.lexicon !== 'FISE2') {
return newGuess;
}
// Replace.
diff --git a/djAerolith/wordwalls/static/js/wordwalls/wordwalls_game.js b/djAerolith/wordwalls/static/js/wordwalls/wordwalls_game.js
index f75c5b7f..4166fc6d 100644
--- a/djAerolith/wordwalls/static/js/wordwalls/wordwalls_game.js
+++ b/djAerolith/wordwalls/static/js/wordwalls/wordwalls_game.js
@@ -103,7 +103,7 @@ class Game {
}
/**
* @param {string} word
- * @return {boolean} Whether the word is in a CSW lexicon and not America.
+ * @return {boolean} Whether the word is in a CSW lexicon and not NWL18.
*/
isCSW(word) {
const w = this.originalWordsHash[word];
diff --git a/djAerolith/wordwalls/stats.py b/djAerolith/wordwalls/stats.py
index a27d5fc6..d552f1a2 100644
--- a/djAerolith/wordwalls/stats.py
+++ b/djAerolith/wordwalls/stats.py
@@ -24,8 +24,8 @@ def get_stats(request, lexicon, type_of_challenge_id):
end_date = request.GET.get('end_date')
lexicon = Lexicon.objects.get(id=lexicon)
- if lexicon.lexiconName in ('OWL2', 'America'):
- lexica = ['OWL2', 'America']
+ if lexicon.lexiconName in ('OWL2', 'America', 'NWL18'):
+ lexica = ['OWL2', 'America', 'NWL18']
elif lexicon.lexiconName in ('CSW12', 'CSW15'):
lexica = ['CSW12', 'CSW15']
else:
diff --git a/djAerolith/wordwalls/templates/wordwalls/stats.html b/djAerolith/wordwalls/templates/wordwalls/stats.html
index b037f886..32ac7ae0 100644
--- a/djAerolith/wordwalls/templates/wordwalls/stats.html
+++ b/djAerolith/wordwalls/templates/wordwalls/stats.html
@@ -22,8 +22,8 @@
Lexicon:
From 8722c779741a62400e6303db8e4a24087f3a5704 Mon Sep 17 00:00:00 2001
From: Cesar Del Solar
Date: Thu, 14 Feb 2019 23:08:43 -0500
Subject: [PATCH 2/4] move to yaml for lexica fixture, fix license text for
naspa
---
.../commands/migrate_list_lexica.py | 31 ++++++++
djAerolith/base/tests/test_wordlist_api.py | 2 +-
djAerolith/lib/tests/test_word_searches.py | 6 +-
djAerolith/lib/word_db_helper.py | 3 +-
.../wordwalls/fixtures/test/lexica.json | 74 -------------------
.../wordwalls/fixtures/test/lexica.yaml | 48 ++++++++++++
.../management/commands/genNamedLists.py | 16 +++-
.../commands/migrate_default_lexica.py | 10 ++-
.../js/wordwalls/newtable/table_creator.jsx | 8 +-
.../static/js/wordwalls/solution.jsx | 2 +-
.../wordwalls/templates/wordwalls/stats.html | 4 +-
djAerolith/wordwalls/tests/test_api.py | 8 +-
.../wordwalls/tests/test_concurrent_solve.py | 2 +-
.../wordwalls/tests/test_file_upload.py | 2 +-
djAerolith/wordwalls/tests/test_game_logic.py | 8 +-
djAerolith/wordwalls/tests/test_game_views.py | 2 +-
16 files changed, 121 insertions(+), 105 deletions(-)
create mode 100644 djAerolith/base/management/commands/migrate_list_lexica.py
delete mode 100644 djAerolith/wordwalls/fixtures/test/lexica.json
create mode 100644 djAerolith/wordwalls/fixtures/test/lexica.yaml
diff --git a/djAerolith/base/management/commands/migrate_list_lexica.py b/djAerolith/base/management/commands/migrate_list_lexica.py
new file mode 100644
index 00000000..767605d0
--- /dev/null
+++ b/djAerolith/base/management/commands/migrate_list_lexica.py
@@ -0,0 +1,31 @@
+"""
+Migrates all lists for users from lexicon1 to lexicon2
+
+"""
+from django.core.management.base import BaseCommand, CommandError
+
+from base.models import Lexicon, SavedList
+
+
+class Command(BaseCommand):
+
+ def add_arguments(self, parser):
+ parser.add_argument('lexicon1', type=str)
+ parser.add_argument('lexicon2', type=str)
+
+ def handle(self, *args, **options):
+ if 'lexicon1' not in options or 'lexicon2' not in options:
+ raise CommandError('Lexica must be specified: Old New')
+ try:
+ lex1 = Lexicon.objects.get(lexiconName=options['lexicon1'])
+ lex2 = Lexicon.objects.get(lexiconName=options['lexicon2'])
+ except Lexicon.DoesNotExist as e:
+ raise CommandError(e)
+
+ count = 0
+ for word_list in SavedList.objects.filter(lexicon=lex1,
+ is_temporary=False):
+ count += 1
+ word_list.lexicon = lex2
+ word_list.save()
+ print('Migrated %s lists from %s to %s' % (count, lex1, lex2))
diff --git a/djAerolith/base/tests/test_wordlist_api.py b/djAerolith/base/tests/test_wordlist_api.py
index bf78b346..bb446e28 100644
--- a/djAerolith/base/tests/test_wordlist_api.py
+++ b/djAerolith/base/tests/test_wordlist_api.py
@@ -10,7 +10,7 @@
class WordwallsAPITest(TestCase):
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'test/word_lists.json']
diff --git a/djAerolith/lib/tests/test_word_searches.py b/djAerolith/lib/tests/test_word_searches.py
index 277491b5..163a9f8c 100644
--- a/djAerolith/lib/tests/test_word_searches.py
+++ b/djAerolith/lib/tests/test_word_searches.py
@@ -11,7 +11,7 @@
class SimpleSearchCase(TestCase):
fixtures = [
- 'test/lexica.json'
+ 'test/lexica.yaml'
]
def setUp(self):
@@ -182,7 +182,7 @@ def test_probability_limit_outside_of_range(self):
class TagSearchCase(TestCase):
fixtures = [
- 'test/lexica.json',
+ 'test/lexica.yaml',
'test/users.json',
'test/profiles.json'
]
@@ -280,7 +280,7 @@ def test_more_tags(self):
class MassiveTagSearchCase(TestCase):
fixtures = [
- 'test/lexica.json',
+ 'test/lexica.yaml',
'test/users.json',
'test/profiles.json'
]
diff --git a/djAerolith/lib/word_db_helper.py b/djAerolith/lib/word_db_helper.py
index 7ffa664b..aa3221e7 100644
--- a/djAerolith/lib/word_db_helper.py
+++ b/djAerolith/lib/word_db_helper.py
@@ -10,8 +10,6 @@
from django.conf import settings
-from base.models import alphagrammize
-
from lib.domain import Word, Alphagram, Question, Questions
from lib.query_generator.exceptions import BadInput
from lib.query_generator.gen import QueryGenerator, MAX_CHUNK_SIZE
@@ -102,6 +100,7 @@ def _alphagrams(c):
c = self.conn.cursor()
ret_alphagrams = []
idx = 0
+ logger.debug('Len alphagrams: %s', len(alphagrams))
while idx < len(alphagrams):
these_alphagrams = alphagrams[idx:idx+MAX_CHUNK_SIZE]
num_alphas = len(these_alphagrams)
diff --git a/djAerolith/wordwalls/fixtures/test/lexica.json b/djAerolith/wordwalls/fixtures/test/lexica.json
deleted file mode 100644
index 2131d02e..00000000
--- a/djAerolith/wordwalls/fixtures/test/lexica.json
+++ /dev/null
@@ -1,74 +0,0 @@
-[
-{
- "fields": {
- "lexiconDescription": "Collins 2015 International English Word List",
- "lengthCounts": "{\"2\":92,\"3\":878,\"4\":3491,\"5\":8654,\"6\":16999,\"7\":27437,\"8\":36327,\"9\":38795,\"10\":34881,\"11\":27862,\"12\":20437,\"13\":14061,\"14\":9251,\"15\":5846}",
- "lexiconName": "CSW15"
- },
- "model": "base.lexicon",
- "pk": 1
-},
-{
- "fields": {
- "lexiconDescription": "I am Trumperica, and so can you.",
- "lengthCounts": "{\"2\":78,\"3\":765,\"4\":2844,\"5\":6797,\"6\":12932,\"7\":21063,\"8\":27962,\"9\":28773,\"10\":22739,\"11\":16769,\"12\":11958,\"13\":8210,\"14\":5380,\"15\":3371}",
- "lexiconName": "America2016"
- },
- "model": "base.lexicon",
- "pk": 2
-},
-{
- "fields": {
- "lexiconDescription": "North American 2006 Official Word List 2006",
- "lengthCounts": "{\"2\":77,\"3\":732,\"4\":2737,\"5\":6495,\"6\":12353,\"7\":20134,\"8\":26563,\"9\":27270,\"10\":21597,\"11\":15886,\"12\":11293,\"13\":7701,\"14\":5034,\"15\":3147}",
- "lexiconName": "OWL2"
- },
- "model": "base.lexicon",
- "pk": 4
-},
-{
- "fields": {
- "lexiconDescription": "Collins 2012 International English Word List",
- "lengthCounts": "{\"2\":92,\"3\":865,\"4\":3443,\"5\":8517,\"6\":16668,\"7\":26797,\"8\":35335,\"9\":37873,\"10\":34177,\"11\":27304,\"12\":20041,\"13\":13779,\"14\":9081,\"15\":5736}",
- "lexiconName": "CSW12"
- },
- "model": "base.lexicon",
- "pk": 6
-},
-{
- "fields": {
- "lexiconDescription": "I am America, and so can you.",
- "lengthCounts": "{\"2\":78,\"3\":765,\"4\":2844,\"5\":6797,\"6\":12932,\"7\":21063,\"8\":27962,\"9\":28773,\"10\":22739,\"11\":16769,\"12\":11958,\"13\":8210,\"14\":5380,\"15\":3371}",
- "lexiconName": "America"
- },
- "model": "base.lexicon",
- "pk": 7
-},
-{
- "fields": {
- "lexiconDescription": "Federación Internacional de Scrabble en Español",
- "lengthCounts": "{\"2\":75,\"3\":411,\"4\":2030,\"5\":7204,\"6\":16339,\"7\":32154,\"8\":50756,\"9\":68345,\"10\":79948,\"11\":76024,\"12\":62015,\"13\":43101,\"14\":25338,\"15\":12788}",
- "lexiconName": "FISE09"
- },
- "model": "base.lexicon",
- "pk": 8
-},
-{
- "fields": {
- "lexiconDescription": "NASPA Word List 2018 Edition",
- "lengthCounts": "{\"2\":75,\"3\":411,\"4\":2030,\"5\":7204,\"6\":16339,\"7\":32154,\"8\":50756,\"9\":68345,\"10\":79948,\"11\":76024,\"12\":62015,\"13\":43101,\"14\":25338,\"15\":12788}",
- "lexiconName": "NWL18"
- },
- "model": "base.lexicon",
- "pk": 9
-},
-{
- "fields": {
- "lexiconDescription": "Federación Internacional de Scrabble en Español, 2017 Edition",
- "lengthCounts": "{\"2\":75,\"3\":411,\"4\":2030,\"5\":7204,\"6\":16339,\"7\":32154,\"8\":50756,\"9\":68345,\"10\":79948,\"11\":76024,\"12\":62015,\"13\":43101,\"14\":25338,\"15\":12788}",
- "lexiconName": "FISE2"
- },
- "model": "base.lexicon",
- "pk": 10
-}
-]
\ No newline at end of file
diff --git a/djAerolith/wordwalls/fixtures/test/lexica.yaml b/djAerolith/wordwalls/fixtures/test/lexica.yaml
new file mode 100644
index 00000000..c8f2b15f
--- /dev/null
+++ b/djAerolith/wordwalls/fixtures/test/lexica.yaml
@@ -0,0 +1,48 @@
+- fields:
+ lengthCounts: '{"2":92,"3":878,"4":3491,"5":8654,"6":16999,"7":27437,"8":36327,"9":38795,"10":34881,"11":27862,"12":20437,"13":14061,"14":9251,"15":5846}'
+ lexiconDescription: Collins 2015 International English Word List
+ lexiconName: CSW15
+ model: base.lexicon
+ pk: 1
+- fields:
+ lengthCounts: '{"2":78,"3":765,"4":2844,"5":6797,"6":12932,"7":21063,"8":27962,"9":28773,"10":22739,"11":16769,"12":11958,"13":8210,"14":5380,"15":3371}'
+ lexiconDescription: I am Trumperica, and so can you.
+ lexiconName: America2016
+ model: base.lexicon
+ pk: 2
+- fields:
+ lengthCounts: '{"2":77,"3":732,"4":2737,"5":6495,"6":12353,"7":20134,"8":26563,"9":27270,"10":21597,"11":15886,"12":11293,"13":7701,"14":5034,"15":3147}'
+ lexiconDescription: North American 2006 Official Word List 2006
+ lexiconName: OWL2
+ model: base.lexicon
+ pk: 4
+- fields:
+ lengthCounts: '{"2":92,"3":865,"4":3443,"5":8517,"6":16668,"7":26797,"8":35335,"9":37873,"10":34177,"11":27304,"12":20041,"13":13779,"14":9081,"15":5736}'
+ lexiconDescription: Collins 2012 International English Word List
+ lexiconName: CSW12
+ model: base.lexicon
+ pk: 6
+- fields:
+ lengthCounts: '{"2":78,"3":765,"4":2844,"5":6797,"6":12932,"7":21063,"8":27962,"9":28773,"10":22739,"11":16769,"12":11958,"13":8210,"14":5380,"15":3371}'
+ lexiconDescription: I am America, and so can you.
+ lexiconName: America
+ model: base.lexicon
+ pk: 7
+- fields:
+ lengthCounts: '{"2":75,"3":411,"4":2030,"5":7204,"6":16339,"7":32154,"8":50756,"9":68345,"10":79948,"11":76024,"12":62015,"13":43101,"14":25338,"15":12788}'
+ lexiconDescription: "Federaci\xF3n Internacional de Scrabble en Espa\xF1ol"
+ lexiconName: FISE09
+ model: base.lexicon
+ pk: 8
+- fields:
+ lengthCounts: '{"10":23928,"11":17577,"12":12362,"13":8410,"14":5526,"15":3478,"2":79,"3":766,"4":2846,"5":6814,"6":12968,"7":21108,"8":28029,"9":28936}'
+ lexiconDescription: NASPA Word List 2018 Edition
+ lexiconName: NWL18
+ model: base.lexicon
+ pk: 9
+- fields:
+ lengthCounts: '{"10":79951,"11":76526,"12":63120,"13":44592,"14":26828,"15":13934,"2":76,"3":426,"4":2046,"5":7179,"6":16232,"7":31901,"8":50413,"9":68121}'
+ lexiconDescription: "Federaci\xF3n Internacional de Scrabble en Espa\xF1ol, 2017 Edition"
+ lexiconName: FISE2
+ model: base.lexicon
+ pk: 10
\ No newline at end of file
diff --git a/djAerolith/wordwalls/management/commands/genNamedLists.py b/djAerolith/wordwalls/management/commands/genNamedLists.py
index 7f157c62..c3233226 100644
--- a/djAerolith/wordwalls/management/commands/genNamedLists.py
+++ b/djAerolith/wordwalls/management/commands/genNamedLists.py
@@ -274,6 +274,14 @@ def create_spanish_lists():
create_named_list(lex, len(qs), i, False, json.dumps(qs),
'Ochos con 5 o más vocales')
+ qs = get_questions_by_condition(
+ db, min_prob, max_prob, i,
+ lambda w: ('+' in w.lexicon_symbols),
+ condition_type=Condition.WORD)
+ create_named_list(
+ lex, len(qs), i, False, json.dumps(qs),
+ 'FISE2 {} nuevos'.format(mapa_amigable[i]))
+
def create_common_words_lists():
"""Creates common words lists for OWL2."""
@@ -311,9 +319,9 @@ def create_common_words_list(lname, friendly_name):
class Command(BaseCommand):
help = """Populates database with named lists"""
- def handle_noargs(self, **options):
- NamedList.objects.filter(lexicon__lexiconName='CSW15').delete()
+ def handle(self, **options):
+ # NamedList.objects.filter(lexicon__lexiconName='CSW15').delete()
for lex in Lexicon.objects.filter(
- lexiconName__in=['NWL18', 'CSW15']):
+ lexiconName__in=['NWL18']):
createNamedLists(lex)
- create_spanish_lists()
+ # create_spanish_lists()
diff --git a/djAerolith/wordwalls/management/commands/migrate_default_lexica.py b/djAerolith/wordwalls/management/commands/migrate_default_lexica.py
index d98605ef..f40cc3f3 100644
--- a/djAerolith/wordwalls/management/commands/migrate_default_lexica.py
+++ b/djAerolith/wordwalls/management/commands/migrate_default_lexica.py
@@ -9,12 +9,16 @@
class Command(BaseCommand):
+ def add_arguments(self, parser):
+ parser.add_argument('lexicon1', type=str)
+ parser.add_argument('lexicon2', type=str)
+
def handle(self, *args, **options):
- if len(args) != 2:
+ if 'lexicon1' not in options or 'lexicon2' not in options:
raise CommandError('Lexica must be specified: Old New')
try:
- lex1 = Lexicon.objects.get(lexiconName=args[0])
- lex2 = Lexicon.objects.get(lexiconName=args[1])
+ lex1 = Lexicon.objects.get(lexiconName=options['lexicon1'])
+ lex2 = Lexicon.objects.get(lexiconName=options['lexicon2'])
except Lexicon.DoesNotExist as e:
raise CommandError(e)
diff --git a/djAerolith/wordwalls/static/js/wordwalls/newtable/table_creator.jsx b/djAerolith/wordwalls/static/js/wordwalls/newtable/table_creator.jsx
index eac5ea2f..cb2726f3 100644
--- a/djAerolith/wordwalls/static/js/wordwalls/newtable/table_creator.jsx
+++ b/djAerolith/wordwalls/static/js/wordwalls/newtable/table_creator.jsx
@@ -34,8 +34,8 @@ const COLLINS_LICENSE_TEXT = `
The Collins Official Scrabble Words 2015 (CSW15) is copyright of
HarperCollins Publishers 2015 and used with permission.`;
const NASPA_LICENSE_TEXT = `
-The NASPA Word List, 2018 Edition (NWL18) is copyright of the North
-American Scrabble Players Association (© 2019) and used with permission.`;
+NASPA Word List, 2018 Edition (NWL18), © 2019 North American Word Game
+Players Association. All rights reserved.`;
const DEFAULT_TIME_PER_QUIZ = '5'; // minutes
@@ -353,9 +353,9 @@ class TableCreator extends React.Component {
renderLicenseText() {
switch (this.state.currentLexicon) {
case COLLINS_LEX_ID:
- return ({COLLINS_LICENSE_TEXT}
);
+ return ({COLLINS_LICENSE_TEXT});
case NWL18_LEX_ID:
- return ({NASPA_LICENSE_TEXT}
);
+ return ({NASPA_LICENSE_TEXT});
default:
return null;
}
diff --git a/djAerolith/wordwalls/static/js/wordwalls/solution.jsx b/djAerolith/wordwalls/static/js/wordwalls/solution.jsx
index 8985d85c..946a34ad 100644
--- a/djAerolith/wordwalls/static/js/wordwalls/solution.jsx
+++ b/djAerolith/wordwalls/static/js/wordwalls/solution.jsx
@@ -80,7 +80,7 @@ class Solution extends React.Component {
text={this.props.backHooks}
/>
- {this.props.definition} |
+ {this.props.definition} |
{markMissedBtn} |
);
diff --git a/djAerolith/wordwalls/templates/wordwalls/stats.html b/djAerolith/wordwalls/templates/wordwalls/stats.html
index 32ac7ae0..9dc28885 100644
--- a/djAerolith/wordwalls/templates/wordwalls/stats.html
+++ b/djAerolith/wordwalls/templates/wordwalls/stats.html
@@ -22,8 +22,8 @@
Lexicon:
diff --git a/djAerolith/wordwalls/tests/test_api.py b/djAerolith/wordwalls/tests/test_api.py
index 7d856ab2..d8e78652 100644
--- a/djAerolith/wordwalls/tests/test_api.py
+++ b/djAerolith/wordwalls/tests/test_api.py
@@ -14,7 +14,7 @@
class WordwallsChallengeAPITest(TestCase):
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'test/word_lists.json',
@@ -79,7 +79,7 @@ def test_future_date_from_request(self):
class WordwallsNewChallengeTest(TestCase):
""" Test the new challenge behavior, list replacement etc """
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'test/word_lists.json',
@@ -145,7 +145,7 @@ def test_replace_challenge(self):
class WordwallsNewSearchTest(TestCase):
""" Test the new search behavior. """
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'test/word_lists.json',
@@ -223,7 +223,7 @@ def test_replace_with_wordlist(self):
class WordwallsSavedListMultiplayerTest(TestCase):
""" Test the new search behavior. """
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'test/word_lists.json',
diff --git a/djAerolith/wordwalls/tests/test_concurrent_solve.py b/djAerolith/wordwalls/tests/test_concurrent_solve.py
index aab6f1d3..0bd80d83 100644
--- a/djAerolith/wordwalls/tests/test_concurrent_solve.py
+++ b/djAerolith/wordwalls/tests/test_concurrent_solve.py
@@ -12,7 +12,7 @@
class WordwallsConcurrentSolveTest(TransactionTestCase):
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'test/word_lists.json']
diff --git a/djAerolith/wordwalls/tests/test_file_upload.py b/djAerolith/wordwalls/tests/test_file_upload.py
index e4e7b65b..53b3b923 100644
--- a/djAerolith/wordwalls/tests/test_file_upload.py
+++ b/djAerolith/wordwalls/tests/test_file_upload.py
@@ -22,7 +22,7 @@
# XXX We should also test the views themselves, which do some UTF8
# manipulation. (ajax_upload particularly)
class FileUploadTestCase(TestCase, WordListAssertMixin):
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'test/word_lists.json']
diff --git a/djAerolith/wordwalls/tests/test_game_logic.py b/djAerolith/wordwalls/tests/test_game_logic.py
index 568121e2..4b1f7250 100644
--- a/djAerolith/wordwalls/tests/test_game_logic.py
+++ b/djAerolith/wordwalls/tests/test_game_logic.py
@@ -28,7 +28,7 @@
class WordwallsBasicLogicTestBase(TestCase, WordListAssertMixin):
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'test/word_lists.json']
@@ -582,7 +582,7 @@ class WordwallsChallengeBehaviorTest(WordwallsBasicLogicTestBase):
etc.
"""
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'challenge_names.json',
@@ -755,7 +755,7 @@ class WordwallsMissedBingosTest(WordwallsBasicLogicTestBase):
challenge 40313, leaderboard 40134, answers: 33 Thurs 8s
"""
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
# Eventually get rid of these two, because they are
# replaced by sqlite, but for now we test for backwards
# compatibility, since we are doing an in-place
@@ -812,7 +812,7 @@ def test_load_missed_bingos(self):
class WordwallsNamedListTest(TestCase, WordListAssertMixin):
""" "Named" lists. """
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'test/word_lists.json',
diff --git a/djAerolith/wordwalls/tests/test_game_views.py b/djAerolith/wordwalls/tests/test_game_views.py
index 0ad80059..df7b382c 100644
--- a/djAerolith/wordwalls/tests/test_game_views.py
+++ b/djAerolith/wordwalls/tests/test_game_views.py
@@ -9,7 +9,7 @@
class WordwallsGameStartTest(TestCase):
- fixtures = ['test/lexica.json',
+ fixtures = ['test/lexica.yaml',
'test/users.json',
'test/profiles.json',
'test/word_lists.json',
From 26ba75f770cd5da9944ac69f9b01d958c686aa9a Mon Sep 17 00:00:00 2001
From: Cesar Del Solar
Date: Thu, 14 Feb 2019 23:48:36 -0500
Subject: [PATCH 3/4] add current version
---
djAerolith/current_version.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/djAerolith/current_version.py b/djAerolith/current_version.py
index 2e677446..3e88af5b 100644
--- a/djAerolith/current_version.py
+++ b/djAerolith/current_version.py
@@ -1 +1 @@
-CURRENT_VERSION = '1.1.6.0'
+CURRENT_VERSION = '1.2.0.0'
From 3179553959385553554133bd53fa6d8dab1bebff Mon Sep 17 00:00:00 2001
From: Cesar Del Solar
Date: Thu, 14 Feb 2019 23:58:05 -0500
Subject: [PATCH 4/4] one more small fix
---
.../static/js/flashcards/views/word_search_form.jsx | 6 ++++++
djAerolith/lib/word_db_helper.py | 1 -
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/djAerolith/flashcards/static/js/flashcards/views/word_search_form.jsx b/djAerolith/flashcards/static/js/flashcards/views/word_search_form.jsx
index a309d9a4..08c9c624 100644
--- a/djAerolith/flashcards/static/js/flashcards/views/word_search_form.jsx
+++ b/djAerolith/flashcards/static/js/flashcards/views/word_search_form.jsx
@@ -22,6 +22,9 @@ const allowedSearchTypes = new Set([
SearchTypesEnum.POINTS,
SearchTypesEnum.NUM_ANAGRAMS,
SearchTypesEnum.NUM_VOWELS,
+ SearchTypesEnum.NOT_IN_LEXICON,
+ SearchTypesEnum.PROBABILITY_LIMIT,
+ SearchTypesEnum.MATCHING_ANAGRAM,
]);
const lexOptions = [{
@@ -30,6 +33,9 @@ const lexOptions = [{
}, {
value: 'CSW15',
displayValue: 'CSW15',
+}, {
+ value: 'America', /* DELETE ME ASAP */
+ displayValue: 'America',
}];
class WordSearchForm extends React.Component {
diff --git a/djAerolith/lib/word_db_helper.py b/djAerolith/lib/word_db_helper.py
index aa3221e7..d9a4ddef 100644
--- a/djAerolith/lib/word_db_helper.py
+++ b/djAerolith/lib/word_db_helper.py
@@ -100,7 +100,6 @@ def _alphagrams(c):
c = self.conn.cursor()
ret_alphagrams = []
idx = 0
- logger.debug('Len alphagrams: %s', len(alphagrams))
while idx < len(alphagrams):
these_alphagrams = alphagrams[idx:idx+MAX_CHUNK_SIZE]
num_alphas = len(these_alphagrams)