adjectives_todo.py 1.13 KB
#! /usr/bin/python
# -*- coding: utf-8 -*-

import sys, os, codecs

from django.core.management.base import BaseCommand

from django.core.exceptions import ObjectDoesNotExist
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):
        nouns_todo()

def nouns_todo():
    adj = POS.objects.get(tag='adj')
    verb = POS.objects.get(tag='verb')
    entries = Entry.objects.filter(pos=adj).order_by('name')
    for entry in entries:
        try:
            temp = entry.actual_lemma()
        except ObjectDoesNotExist:
            continue
        rel_entries = entry.rel_entries.filter(pos=verb)
        for rel_entry in rel_entries:
            try:
                temp = entry.actual_lemma()
            except ObjectDoesNotExist:
                continue
            if rel_entry.actual_lemma().status.priority == 100:
                print entry.name, ' ', entry.actual_lemma().status.status, '\t->\t', rel_entry.name, ' ', rel_entry.actual_lemma().status.status