add_skl_arg_realizations.py 726 Bytes
#-*- coding:utf-8 -*-

import codecs
import re

from django.core.management.base import BaseCommand

from common.util import triple_arg_poss
from dictionary.models import Skladnica_Argument

VERBS_IN_DICT = 500

class Command(BaseCommand):
    args = 'none'
    help = """
    Add skladnica arguments realizations to existing skladnica
    arguments.
    """

    def handle(self, **options):
        add_skl_arg_realizations()
        
def add_skl_arg_realizations():
    skl_arg_text_rep = 'advp'
    realizations = triple_arg_poss('advp(pred)', ['', 'obj', 'subj'])
    
    for skl_arg in Skladnica_Argument.objects.filter(text_rep=skl_arg_text_rep):
        print skl_arg
        skl_arg.possible_args.add(*realizations)