Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Commit

Permalink
Sloppily avoid crash when noun entry does not specify animacy. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
eddieantonio committed Feb 1, 2019
1 parent 208f190 commit 3a3104c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Searching for 'ayahciyiniw' yields 500 error:
* KeyError: u'maskwacis_dictionary in template </templates/itwewina/about.template>'
*
* See: https://github.com/UAlbertaALTLab/itwewina/issues/113
*/
describe('GitHub issue 117', function () {
it('should not crash when searching for "ayahciyiniw"', function () {
cy.instantNeahttaSearch('crk', 'eng', 'ayahciyiniw');
cy.contains('.lexeme:first a', 'ayahciyiniw');
});
});
7 changes: 7 additions & 0 deletions neahtta/morpholex/morpho_lexicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,13 @@ def crk_analysis_matches_dict_entry(analysis, entry):
assert lexeme_class is not None, \
"Could not find a lexeme class for %r" % (entry.findtext('.//l'),)

if lexeme_class.strip() == '':
# XXX: as of 2019-01-15, some entries HAVE NOTHING for <lc>.
# See: https://github.com/UAlbertaALTLab/itwewina/issues/120
# They really, really *should*. Without it, we don't know the animacy of the word,
# and thus this match is meaningless. So say it doesn't match!
return False

entry_pos, _, _variant = lexeme_class.partition(u'-')
assert entry_pos in (u'NI', u'NA', u'NDI', u'NDA')
entry_animacy = entry_pos[-1]
Expand Down

0 comments on commit 3a3104c

Please sign in to comment.