create_roles_display.py
3.77 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#! /usr/bin/python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from semantics.models import SemanticRole, SemanticRolesDisplay
#==========================================================#
class Command(BaseCommand):
args = 'none'
help = ''
def handle(self, **options):
import_roles_table()
def import_roles_table():
# row 1:
display = SemanticRolesDisplay(row=1, column=1, rowspan=1, colspan=1, caption="")
display.save()
display = SemanticRolesDisplay(row=1, column=2, rowspan=1, colspan=1, caption="Grupa inicjująca")
display.save()
display = SemanticRolesDisplay(row=1, column=3, rowspan=1, colspan=1, caption="Grupa towarzysząca")
display.save()
display = SemanticRolesDisplay(row=1, column=4, rowspan=1, colspan=1, caption="Grupa zamykająca")
display.save()
# row 2
display = SemanticRolesDisplay(row=2, column=1, rowspan=1, colspan=1, caption="Podstawowe")
display.save()
display = SemanticRolesDisplay(row=2, column=2, rowspan=1, colspan=1)
display.save()
role = SemanticRole.objects.get(role='Initiator')
display.roles.add(role)
role = SemanticRole.objects.get(role='Stimulus')
display.roles.add(role)
display = SemanticRolesDisplay(row=2, column=3, rowspan=1, colspan=1)
display.save()
role = SemanticRole.objects.get(role='Theme')
display.roles.add(role)
role = SemanticRole.objects.get(role='Experiencer')
display.roles.add(role)
role = SemanticRole.objects.get(role='Factor')
display.roles.add(role)
role = SemanticRole.objects.get(role='Instrument')
display.roles.add(role)
display = SemanticRolesDisplay(row=2, column=4, rowspan=1, colspan=1)
display.save()
role = SemanticRole.objects.get(role='Recipient')
display.roles.add(role)
role = SemanticRole.objects.get(role='Result')
display.roles.add(role)
# row 3:
display = SemanticRolesDisplay(row=3, column=1, rowspan=1, colspan=1, caption="Uzupełniające")
display.save()
display = SemanticRolesDisplay(row=3, column=2, rowspan=1, colspan=1)
display.save()
role = SemanticRole.objects.get(role='Cause')
display.roles.add(role)
role = SemanticRole.objects.get(role='Condition')
display.roles.add(role)
display = SemanticRolesDisplay(row=3, column=3, rowspan=1, colspan=1)
display.save()
role = SemanticRole.objects.get(role='Attribute')
display.roles.add(role)
role = SemanticRole.objects.get(role='Manner')
display.roles.add(role)
role = SemanticRole.objects.get(role='Measure')
display.roles.add(role)
role = SemanticRole.objects.get(role='Location')
display.roles.add(role)
role = SemanticRole.objects.get(role='Path')
display.roles.add(role)
role = SemanticRole.objects.get(role='Time')
display.roles.add(role)
role = SemanticRole.objects.get(role='Duration')
display.roles.add(role)
display = SemanticRolesDisplay(row=3, column=4, rowspan=1, colspan=1)
display.save()
role = SemanticRole.objects.get(role='Purpose')
display.roles.add(role)
# row 4:
display = SemanticRolesDisplay(row=4, column=1, rowspan=1, colspan=1, caption="Atrybuty")
display.save()
display = SemanticRolesDisplay(row=4, column=2, rowspan=1, colspan=1)
display.save()
role = SemanticRole.objects.get(role='Source')
display.roles.add(role)
display = SemanticRolesDisplay(row=4, column=3, rowspan=1, colspan=1)
display.save()
role = SemanticRole.objects.get(role='Foreground')
display.roles.add(role)
role = SemanticRole.objects.get(role='Background')
display.roles.add(role)
display = SemanticRolesDisplay(row=4, column=4, rowspan=1, colspan=1)
display.save()
role = SemanticRole.objects.get(role='Goal')
display.roles.add(role)