nouns_syntax_todo.py
1.1 KB
#! /usr/bin/python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.core.exceptions import ObjectDoesNotExist
from dictionary.models import Entry, POS
class Command(BaseCommand):
args = 'none'
help = ''
def handle(self, **options):
nouns_todo()
def nouns_todo():
noun = POS.objects.get(tag='noun')
verb = POS.objects.get(tag='verb')
entries = Entry.objects.filter(pos=noun).order_by('name')
for entry in entries:
try:
temp = entry.actual_lemma()
except ObjectDoesNotExist:
continue
if entry.actual_lemma().status.priority == 10:
rel_entries = entry.related_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 >= 90:
print entry.name, ' ', entry.actual_lemma().status.status, '\t->\t', rel_entry.name, ' ', rel_entry.actual_lemma().status.status