verbs_semantics_todo.py
1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /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():
verb = POS.objects.get(tag='verb')
noun = POS.objects.get(tag='noun')
entries = Entry.objects.filter(pos=verb).order_by('name')
for entry in entries:
try:
temp = entry.actual_lemma()
except ObjectDoesNotExist:
continue
if entry.actual_lemma().status.priority == 40 or entry.actual_lemma().status.priority == 70:
rel_entries = entry.rel_entries.filter(pos=noun)
for rel_entry in rel_entries:
try:
temp = rel_entry.actual_lemma()
except ObjectDoesNotExist:
continue
if rel_entry.actual_lemma().status.priority == 40:
print entry.name, ' ', entry.actual_lemma().status.status, '\t->\t', rel_entry.name, ' ', rel_entry.actual_lemma().status.status