auto_derivatives.py 939 Bytes
# -*- coding: utf-8 -*-
from dictionary.models import Ending


def lexeme_derivatives(lexeme):
    if lexeme.part_of_speech.symbol == 'v':
        proper = lexeme.lexemeattributevalue_set.filter(
            attribute__name=u'właściwy', value__in=('', '(Q)'))
        if proper:
            # ger, pact, ppas, appas
            patterns = list(lexeme.patterns.all())
            endings3 = Ending.objects.filter(
                pattern__in=patterns, base_form_label='3')
            endings10 = Ending.objects.filter(
                pattern__in=patterns, base_form_label='10')
            endings11 = Ending.objects.filter(
                pattern__in=patterns, base_form_label='11')
            endings12 = Ending.objects.filter(
                pattern__in=patterns, base_form_label='12')
            for ending in endings11:
                # ger
                pass


def create_derivative(lexeme, part_of_speech, root):
    pass