Commit 2e46f098ff36d935fa59f7170ff7730b4590e6fd

Authored by Tomasz Bartosiak
1 parent c27d679d

Scripts for Ela

semantics/management/commands/adjectives_todo.py 0 → 100644
  1 +#! /usr/bin/python
  2 +# -*- coding: utf-8 -*-
  3 +
  4 +import sys, os, codecs
  5 +
  6 +from django.core.management.base import BaseCommand
  7 +
  8 +from django.core.exceptions import ObjectDoesNotExist
  9 +from dictionary.models import Entry, POS
  10 +from wordnet.models import LexicalUnit
  11 +from settings import PROJECT_PATH
  12 +
  13 +class Command(BaseCommand):
  14 + args = 'none'
  15 + help = ''
  16 +
  17 + def handle(self, **options):
  18 + nouns_todo()
  19 +
  20 +def nouns_todo():
  21 + adj = POS.objects.get(tag='adj')
  22 + verb = POS.objects.get(tag='verb')
  23 + entries = Entry.objects.filter(pos=adj).order_by('name')
  24 + for entry in entries:
  25 + try:
  26 + temp = entry.actual_lemma()
  27 + except ObjectDoesNotExist:
  28 + continue
  29 + rel_entries = entry.rel_entries.filter(pos=verb)
  30 + for rel_entry in rel_entries:
  31 + try:
  32 + temp = entry.actual_lemma()
  33 + except ObjectDoesNotExist:
  34 + continue
  35 + if rel_entry.actual_lemma().status.priority == 100:
  36 + print entry.name, ' ', entry.actual_lemma().status.status, '\t->\t', rel_entry.name, ' ', rel_entry.actual_lemma().status.status
  37 +
... ...
semantics/management/commands/nouns_semantics_todo.py 0 → 100644
  1 +#! /usr/bin/python
  2 +# -*- coding: utf-8 -*-
  3 +
  4 +import sys, os, codecs
  5 +
  6 +from django.core.management.base import BaseCommand
  7 +
  8 +from django.core.exceptions import ObjectDoesNotExist
  9 +from dictionary.models import Entry, POS
  10 +from wordnet.models import LexicalUnit
  11 +from settings import PROJECT_PATH
  12 +
  13 +class Command(BaseCommand):
  14 + args = 'none'
  15 + help = ''
  16 +
  17 + def handle(self, **options):
  18 + nouns_todo()
  19 +
  20 +def nouns_todo():
  21 + noun = POS.objects.get(tag='noun')
  22 + verb = POS.objects.get(tag='verb')
  23 + entries = Entry.objects.filter(pos=noun).order_by('name')
  24 + for entry in entries:
  25 + try:
  26 + temp = entry.actual_lemma()
  27 + except ObjectDoesNotExist:
  28 + continue
  29 + if entry.actual_lemma().status.priority == 40:
  30 + rel_entries = entry.rel_entries.filter(pos=verb)
  31 + for rel_entry in rel_entries:
  32 + try:
  33 + temp = entry.actual_lemma()
  34 + except ObjectDoesNotExist:
  35 + continue
  36 + if rel_entry.actual_lemma().status.priority >= 90:
  37 + print entry.name, ' ', entry.actual_lemma().status.status, '\t->\t', rel_entry.name, ' ', rel_entry.actual_lemma().status.status
  38 +
... ...
semantics/management/commands/nouns_syntax_todo.py 0 → 100644
  1 +#! /usr/bin/python
  2 +# -*- coding: utf-8 -*-
  3 +
  4 +import sys, os, codecs
  5 +
  6 +from django.core.management.base import BaseCommand
  7 +
  8 +from django.core.exceptions import ObjectDoesNotExist
  9 +from dictionary.models import Entry, POS
  10 +from wordnet.models import LexicalUnit
  11 +from settings import PROJECT_PATH
  12 +
  13 +class Command(BaseCommand):
  14 + args = 'none'
  15 + help = ''
  16 +
  17 + def handle(self, **options):
  18 + nouns_todo()
  19 +
  20 +def nouns_todo():
  21 + noun = POS.objects.get(tag='noun')
  22 + verb = POS.objects.get(tag='verb')
  23 + entries = Entry.objects.filter(pos=noun).order_by('name')
  24 + for entry in entries:
  25 + try:
  26 + temp = entry.actual_lemma()
  27 + except ObjectDoesNotExist:
  28 + continue
  29 + if entry.actual_lemma().status.priority == 10:
  30 + rel_entries = entry.rel_entries.filter(pos=verb)
  31 + for rel_entry in rel_entries:
  32 + try:
  33 + temp = entry.actual_lemma()
  34 + except ObjectDoesNotExist:
  35 + continue
  36 + if rel_entry.actual_lemma().status.priority >= 90:
  37 + print entry.name, ' ', entry.actual_lemma().status.status, '\t->\t', rel_entry.name, ' ', rel_entry.actual_lemma().status.status
  38 +
... ...
semantics/management/commands/nouns_todo.py
... ... @@ -5,6 +5,7 @@ import sys, os, codecs
5 5  
6 6 from django.core.management.base import BaseCommand
7 7  
  8 +from django.core.exceptions import ObjectDoesNotExist
8 9 from dictionary.models import Entry, POS
9 10 from wordnet.models import LexicalUnit
10 11 from settings import PROJECT_PATH
... ... @@ -18,10 +19,15 @@ class Command(BaseCommand):
18 19  
19 20 def nouns_todo():
20 21 noun = POS.objects.get(tag='noun')
21   - entries = Entry.objects.filter(pos=noun)
  22 + entries = Entry.objects.filter(pos=noun).order_by('name')
22 23 for entry in entries:
23   - rel_entries = entry.rel_entries.all()
24   - for rel_entry in rel_entries:
25   - if rel_entry.actual_lemma().status.priority >= 90:
26   - print entry.name
  24 + try:
  25 + temp = entry.actual_lemma()
  26 + except ObjectDoesNotExist:
  27 + continue
  28 + if entry.actual_lemma().status.priority == 40:
  29 + rel_entries = entry.rel_entries.all()
  30 + for rel_entry in rel_entries:
  31 + if rel_entry.actual_lemma().status.priority >= 90:
  32 + print entry.name, ' ', entry.actual_lemma().status.status, '\t->\t', rel_entry.name, ' ', rel_entry.actual_lemma().status.status
27 33  
... ...
semantics/management/commands/verbs_semantics_todo.py 0 → 100644
  1 +#! /usr/bin/python
  2 +# -*- coding: utf-8 -*-
  3 +
  4 +import sys, os, codecs
  5 +
  6 +from django.core.management.base import BaseCommand
  7 +
  8 +from django.core.exceptions import ObjectDoesNotExist
  9 +from dictionary.models import Entry, POS
  10 +from wordnet.models import LexicalUnit
  11 +from settings import PROJECT_PATH
  12 +
  13 +class Command(BaseCommand):
  14 + args = 'none'
  15 + help = ''
  16 +
  17 + def handle(self, **options):
  18 + nouns_todo()
  19 +
  20 +def nouns_todo():
  21 + verb = POS.objects.get(tag='verb')
  22 + noun = POS.objects.get(tag='noun')
  23 + entries = Entry.objects.filter(pos=verb).order_by('name')
  24 + for entry in entries:
  25 + try:
  26 + temp = entry.actual_lemma()
  27 + except ObjectDoesNotExist:
  28 + continue
  29 + if entry.actual_lemma().status.priority == 40 or entry.actual_lemma().status.priority == 70:
  30 + rel_entries = entry.rel_entries.filter(pos=noun)
  31 + for rel_entry in rel_entries:
  32 + try:
  33 + temp = rel_entry.actual_lemma()
  34 + except ObjectDoesNotExist:
  35 + continue
  36 + if rel_entry.actual_lemma().status.priority == 40:
  37 + print entry.name, ' ', entry.actual_lemma().status.status, '\t->\t', rel_entry.name, ' ', rel_entry.actual_lemma().status.status
  38 +
... ...