connect_adjective_lexical_units.py
668 Bytes
#! /usr/bin/python
# -*- coding: utf-8 -*-
import sys, os, codecs
from django.core.management.base import BaseCommand
from dictionary.models import Entry, POS
from wordnet.models import LexicalUnit
from settings import PROJECT_PATH
class Command(BaseCommand):
args = 'none'
help = ''
def handle(self, **options):
connect_nouns()
def connect_nouns():
adj = POS.objects.get(tag='adj')
entries = Entry.objects.filter(pos=adj)
for entry in entries:
lus = LexicalUnit.objects.filter(base=entry.name, pos=u'przymiotnik')
for lu in lus:
lu.entry = entry
lu.save()