Commit 58cc002b19e0b31c00e62b515649ba6730b9953c

Authored by Bartłomiej Nitoń
1 parent 890e23ed

Added new semantic validation rule checking whether there are no hanging meanings in the entry.

Showing 1 changed file with 10 additions and 0 deletions
semantics/validation.py
... ... @@ -186,6 +186,10 @@ def validate_lexical_units(lemma_id):
186 186 for lex_unit in lexical_units.all():
187 187 if not examples_reflex_agreed(lex_unit):
188 188 error_msg = u'Semantyka: Znaczenie %s ma podpięte przykłady o niezgodnej zwrotności.' % unicode(lex_unit)
  189 + elif hanging_meaning(lex_unit):
  190 + error_msg = u'Semantyka: Znaczenie %s nie jest reprezentowane przez żadną ramę semantyczną.' % unicode(lex_unit)
  191 + if error_msg:
  192 + break
189 193 return error_msg
190 194  
191 195 def examples_reflex_agreed(lexical_unit):
... ... @@ -197,3 +201,9 @@ def examples_reflex_agreed(lexical_unit):
197 201 lex_example.example.arguments.filter(arguments__type__in=reflex_phrase_types()).exists())):
198 202 return False
199 203 return True
  204 +
  205 +def hanging_meaning(lexical_unit):
  206 + if lexical_unit.luid < 0 and not lexical_unit.actual_frames().exists():
  207 + return True
  208 + return False
  209 +
200 210 \ No newline at end of file
... ...