Commit 8d5df9d615310766c588294951d93f48d37f37dc
1 parent
02b29870
lexical_class -> inflection_type
--HG-- branch : beta
Showing
21 changed files
with
88 additions
and
135 deletions
dictionary/ajax_lexeme_view.py
... | ... | @@ -675,7 +675,7 @@ def cr_homonyms(request, entry, cr_type): |
675 | 675 | def middle_fields(lexeme, lip_data): |
676 | 676 | aspect_value = lexeme.attribute_value(aspect) |
677 | 677 | return aspect_value.value if aspect_value else '', |
678 | - elif pos.lexical_class_id == 'subst': | |
678 | + elif pos.inflection_type_id == 'subst': | |
679 | 679 | middle_labels = (_(u'Gender'),) |
680 | 680 | |
681 | 681 | def middle_fields(lexeme, lip_data): |
... | ... |
dictionary/forms.py
... | ... | @@ -206,17 +206,17 @@ class LIPEditForm(ModelForm): |
206 | 206 | qualifiers = QualifiersField( |
207 | 207 | required=False, label=_(u'Qual.'), |
208 | 208 | widget=SelectMultiple(attrs={'class': 'lip-qualifiers'})) |
209 | - lexical_class = CharField( | |
210 | - widget=HiddenInput(attrs={'class': 'lip-lc'}), label=u'') | |
209 | + inflection_type = CharField( | |
210 | + widget=HiddenInput(attrs={'class': 'lip-it'}), label=u'') | |
211 | 211 | |
212 | 212 | def __init__(self, part_of_speech, user, editable=True, index=None, |
213 | 213 | **kwargs): |
214 | 214 | super(LIPEditForm, self).__init__(**kwargs) |
215 | - if part_of_speech.lexical_class_id != 'subst': | |
215 | + if part_of_speech.inflection_type_id != 'subst': | |
216 | 216 | self.fields['gender'].widget = HiddenInput() |
217 | 217 | self.fields['gender'].label = '' |
218 | 218 | instance = getattr(self, 'instance', None) |
219 | - self.fields['lexical_class'].initial = part_of_speech.lexical_class_id | |
219 | + self.fields['inflection_type'].initial = part_of_speech.inflection_type_id | |
220 | 220 | self.fields['qualifiers'].set_qualifiers( |
221 | 221 | user, instance, types=[Qualifier.TYPE_STYLE, Qualifier.TYPE_FORM]) |
222 | 222 | if instance and instance.id: |
... | ... | @@ -234,8 +234,8 @@ class LIPEditForm(ModelForm): |
234 | 234 | pattern = Pattern.objects.get(name=cleaned_data['pattern_name']) |
235 | 235 | except Pattern.DoesNotExist: |
236 | 236 | raise ValidationError(_(u'Incorrect pattern name.')) |
237 | - lc = cleaned_data['lexical_class'] | |
238 | - if pattern.type.lexical_class_id != lc: | |
237 | + it = cleaned_data['inflection_type'] | |
238 | + if pattern.type.inflection_type_id != it: | |
239 | 239 | raise ValidationError( |
240 | 240 | _(u'The pattern doesn\'t match the part of speech')) |
241 | 241 | cleaned_data['pattern'] = pattern |
... | ... |
dictionary/management/commands/fix_osc.py deleted
1 | -# -*- coding: utf-8 -*- | |
2 | - | |
3 | -from django.core.management.base import BaseCommand | |
4 | -from common.util import no_history, debug | |
5 | -from dictionary.models import Lexeme, Vocabulary, PartOfSpeech, CrossReference | |
6 | - | |
7 | - | |
8 | -class Command(BaseCommand): | |
9 | - args = 'none' | |
10 | - help = 'Fixes osc' | |
11 | - | |
12 | - def handle(self, **options): | |
13 | - fix_osc() | |
14 | - | |
15 | -# aktualnie ลฤ czymy tylko jeลli razem z -oลciฤ przyszedล odpowiedni przymiotnik | |
16 | -# lub wersja niezanegowana (dla zanegowanych) | |
17 | - | |
18 | -def fix_osc(): | |
19 | - no_history() | |
20 | - morfologik = Vocabulary.objects.get(id='Morfologik') | |
21 | - morf = morfologik.owned_lexemes_pk() | |
22 | - existing = Lexeme.objects | |
23 | - morf_osc = existing.filter( | |
24 | - pk__in=morf, part_of_speech__symbol='subst', entry__endswith=u'oลฤ') | |
25 | - for lexeme in morf_osc: | |
26 | - if lexeme.entry.endswith(u'joลฤ'): | |
27 | - base = lexeme.entry[:-4] | |
28 | - else: | |
29 | - base = lexeme.entry[:-3] | |
30 | - options = (base + 'i', base + 'y', base) | |
31 | - adjs = existing.filter( | |
32 | - pk__in=morf, part_of_speech__lexical_class__symbol='adj', | |
33 | - entry__in=options) | |
34 | - if adjs.count() > 1: | |
35 | - debug(lexeme.entry, u'Niejednoznaczny przymiotnik ลบrรณdลowy') | |
36 | - if adjs: | |
37 | - lexeme.part_of_speech = PartOfSpeech.objects.get(symbol='osc') | |
38 | - lexeme.save() | |
39 | - negs = CrossReference.objects.filter( | |
40 | - from_lexeme__in=adjs, type__symbol='nieadj') | |
41 | - if negs: | |
42 | - # wszystkie przymiotniki z Morfologika majฤ negacjฤ nie+, nie nie-+ | |
43 | - # wyglฤ da na to, ลผe w M nie ma nie-...-oลci... | |
44 | - assert lexeme.entry.startswith('nie') | |
45 | - nonnegs = existing.filter(pk__in=morf, entry=lexeme.entry[4:]) | |
46 | - if nonnegs.count() > 1: | |
47 | - debug(lexeme.entry, u'Niejednoznaczna wersja niezanegowana') | |
48 | - if not nonnegs: | |
49 | - debug(lexeme.entry, u'Nie znaleziono wersji niezanegowanej') | |
50 | - else: | |
51 | - for l in nonnegs: | |
52 | - cr = CrossReference( | |
53 | - from_lexeme=lexeme, to_lexeme=l, | |
54 | - type__symbol='nieadj') | |
55 | - cr.save() | |
56 | - cr = CrossReference( | |
57 | - from_lexeme=l, to_lexeme=lexeme, | |
58 | - type__symbol='adjnie') | |
59 | - cr.save() | |
60 | - debug(lexeme.entry, u'Dopisano jako negacjฤ osc') | |
61 | - else: | |
62 | - for adj in adjs: | |
63 | - cr = CrossReference( | |
64 | - from_lexeme=lexeme, to_lexeme=adj, | |
65 | - type__symbol='oscadj') | |
66 | - cr.save() | |
67 | - cr = CrossReference( | |
68 | - from_lexeme=adj, to_lexeme=lexeme, | |
69 | - type__symbol='adjosc') | |
70 | - cr.save() | |
71 | - debug(lexeme.entry, u'Dopisano jako osc') |
dictionary/management/commands/import_skr.py
... | ... | @@ -33,7 +33,7 @@ def import_skr(db_name): |
33 | 33 | |
34 | 34 | sgjp = Vocabulary.objects.get(id='SGJP') |
35 | 35 | zmiotki = Vocabulary.objects.get(id='zmiotki') |
36 | - pattern = Pattern.objects.get(type__lexical_class_id='skr') | |
36 | + pattern = Pattern.objects.get(type__inflection_type_id='skr') | |
37 | 37 | |
38 | 38 | qual_dict = dict(Qualifier.objects.values_list('label', 'id')) |
39 | 39 | result = sqlite_cursor.execute( |
... | ... |
dictionary/migrations/0018_auto_20151215_1428.py
0 โ 100644
1 | +# -*- coding: utf-8 -*- | |
2 | +from __future__ import unicode_literals | |
3 | + | |
4 | +from django.db import migrations, models | |
5 | + | |
6 | + | |
7 | +class Migration(migrations.Migration): | |
8 | + | |
9 | + dependencies = [ | |
10 | + ('dictionary', '0017_auto_20151213_1400'), | |
11 | + ] | |
12 | + | |
13 | + operations = [ | |
14 | + migrations.RenameField( | |
15 | + model_name='partofspeech', | |
16 | + old_name='lexical_class', | |
17 | + new_name='inflection_type', | |
18 | + ), | |
19 | + ] | |
... | ... |
dictionary/models.py
... | ... | @@ -56,7 +56,7 @@ class POSName(Model): |
56 | 56 | |
57 | 57 | class PartOfSpeech(Model): |
58 | 58 | symbol = CharField(primary_key=True, max_length=16, db_column='pos') |
59 | - lexical_class = ForeignKey(InflectionType, db_column='czm') | |
59 | + inflection_type = ForeignKey(InflectionType, db_column='czm') | |
60 | 60 | full_name = CharField(max_length=128, db_column='nazwa') |
61 | 61 | pos_name = ForeignKey(POSName) |
62 | 62 | index = IntegerField() |
... | ... | @@ -537,7 +537,7 @@ class Lexeme(Model): |
537 | 537 | |
538 | 538 | def attributes(self, part_of_speech=None, genders=None): |
539 | 539 | pos = part_of_speech or self.part_of_speech |
540 | - if genders is None and pos.lexical_class_id == 'subst': | |
540 | + if genders is None and pos.inflection_type_id == 'subst': | |
541 | 541 | lips = self.lexemeinflectionpattern_set.all() |
542 | 542 | genders = [lip.gender for lip in lips] |
543 | 543 | elif genders is None: |
... | ... | @@ -932,8 +932,12 @@ REVERSE_CR_TYPE = { |
932 | 932 | # zdrobod, zgrubod -- brak zwrotnych odsyลaczy |
933 | 933 | } |
934 | 934 | |
935 | -for cr_symbol, rev_symbol in list(REVERSE_CR_TYPE.iteritems()): | |
936 | - REVERSE_CR_TYPE[rev_symbol] = cr_symbol | |
935 | + | |
936 | +def _complete_reverse_cr_type(): | |
937 | + for cr_symbol, rev_symbol in list(REVERSE_CR_TYPE.iteritems()): | |
938 | + REVERSE_CR_TYPE[rev_symbol] = cr_symbol | |
939 | + | |
940 | +_complete_reverse_cr_type() | |
937 | 941 | |
938 | 942 | |
939 | 943 | class CrossReferenceType(Model): |
... | ... |
dictionary/reports.py
... | ... | @@ -37,11 +37,11 @@ def verbs_without_derivatives(): |
37 | 37 | appas = CrossReferenceType.objects.get( |
38 | 38 | symbol='verppas', to_pos__symbol='appas') |
39 | 39 | patterns10 = list(Pattern.objects.filter( |
40 | - type__lexical_class_id='v', endings__base_form_label__symbol='10')) | |
40 | + type__inflection_type_id='v', endings__base_form_label__symbol='10')) | |
41 | 41 | patterns11 = list(Pattern.objects.filter( |
42 | - type__lexical_class_id='v', endings__base_form_label__symbol='11')) | |
42 | + type__inflection_type_id='v', endings__base_form_label__symbol='11')) | |
43 | 43 | patterns3 = list(Pattern.objects.filter( |
44 | - type__lexical_class_id='v', endings__base_form_label__symbol='3')) | |
44 | + type__inflection_type_id='v', endings__base_form_label__symbol='3')) | |
45 | 45 | proper_verbs = Lexeme.objects.filter( |
46 | 46 | part_of_speech__symbol='v', lexemeattributevalue__in=proper) |
47 | 47 | # czasownik wลaลciwy przechodni wymaga imiesลowu biernego |
... | ... |
dictionary/static/js/lexeme-edit.js
... | ... | @@ -980,7 +980,7 @@ var check_pos = function () { |
980 | 980 | reload_preview = true; |
981 | 981 | }); |
982 | 982 | } |
983 | - lip_row_elems.find('.lip-lc').val($dj.lexical_classes[pos]); | |
983 | + lip_row_elems.find('.lip-it').val($dj.inflection_types[pos]); | |
984 | 984 | if (reload_preview) |
985 | 985 | $('#table-preview').html(''); |
986 | 986 | cr_row_elems.each(function () { |
... | ... |
dictionary/templates/inflection_tables.html
dictionary/views.py
... | ... | @@ -163,8 +163,8 @@ def lexeme_view(request): |
163 | 163 | (bs.id, bs.label) for bs in BorrowingSource.objects.all()], |
164 | 164 | 'user_options': [(0, u'(brak)')] + user_options, |
165 | 165 | 'exclusion_classes': exclusion_classes, |
166 | - 'lexical_classes': dict( | |
167 | - PartOfSpeech.objects.values_list('symbol', 'lexical_class')), | |
166 | + 'inflection_types': dict( | |
167 | + PartOfSpeech.objects.values_list('symbol', 'inflection_type')), | |
168 | 168 | 'auto_search': request.user.usersettings.incremental_search, |
169 | 169 | 'default_owner': default_owner.id if default_owner else '', |
170 | 170 | }) |
... | ... |
patterns/ajax_pattern_view.py
... | ... | @@ -25,14 +25,14 @@ COLOR_SCHEMES = dict(InflectionType.objects.values_list('symbol', 'color_scheme' |
25 | 25 | class PatternQuery(SlickGridQuery): |
26 | 26 | model = Pattern |
27 | 27 | sort_field = 'name' |
28 | - select_related = ['type__lexical_class'] | |
28 | + select_related = ['type__inflection_type'] | |
29 | 29 | default_columns = ('name', 'type') |
30 | 30 | column_data = { |
31 | 31 | 'id': lambda pattern: pattern.id, |
32 | - 'scheme': lambda pattern: COLOR_SCHEMES[pattern.type.lexical_class_id], | |
32 | + 'scheme': lambda pattern: COLOR_SCHEMES[pattern.type.inflection_type_id], | |
33 | 33 | 'name': lambda pattern: pattern.name, |
34 | 34 | 'type': lambda pattern: pattern.type.symbol, |
35 | - 'lexical_class': lambda pattern: pattern.type.lexical_class_id, | |
35 | + 'inflection_type': lambda pattern: pattern.type.inflection_type_id, | |
36 | 36 | 'example': |
37 | 37 | lambda pattern: pattern.example + u'ยท' + pattern.basic_form_ending, |
38 | 38 | } |
... | ... | @@ -40,7 +40,7 @@ class PatternQuery(SlickGridQuery): |
40 | 40 | literal_filter_fields = ['name', 'old_name', 'type'] |
41 | 41 | |
42 | 42 | filter_field_translation = { |
43 | - 'lexical_class': 'type__lexical_class__symbol', | |
43 | + 'inflection_type': 'type__inflection_type_id', | |
44 | 44 | 'base_form_label': 'endings__base_form_label__symbol', |
45 | 45 | } |
46 | 46 | |
... | ... | @@ -120,7 +120,7 @@ def pattern_preview(request, id, reader=False): |
120 | 120 | def lexeme_count(q): |
121 | 121 | return q.values('lexeme').distinct().count() |
122 | 122 | |
123 | - if pattern.type.lexical_class_id == 'subst': | |
123 | + if pattern.type.inflection_type_id == 'subst': | |
124 | 124 | for gender in Gender.objects.all(): |
125 | 125 | gender_count = lexeme_count(lips.filter(gender=gender)) |
126 | 126 | if gender_count > 0: |
... | ... | @@ -202,7 +202,7 @@ def new_ending_table_row(request, bfl_id): |
202 | 202 | def update_pattern(request, form_data): |
203 | 203 | form_dict = dict((x['name'], x['value']) for x in form_data) |
204 | 204 | p = Pattern.all_objects.get(pk=form_dict['id']) |
205 | - lc = p.type.lexical_class | |
205 | + it = p.type.inflection_type | |
206 | 206 | form = PatternEditForm(data=form_dict, instance=p) |
207 | 207 | endings_changed = False |
208 | 208 | if form.is_valid(): |
... | ... | @@ -216,7 +216,7 @@ def update_pattern(request, form_data): |
216 | 216 | for bfl_endings in form_dict['ending_list']: |
217 | 217 | endings_data = bfl_endings['endings'] |
218 | 218 | bfl = BaseFormLabel.objects.get( |
219 | - symbol=bfl_endings['base_form_label'], lexical_class=lc) | |
219 | + symbol=bfl_endings['base_form_label'], inflection_type=it) | |
220 | 220 | for index, ending_data in enumerate(endings_data, 1): |
221 | 221 | quals = set(int(q) for q in ending_data['qualifiers']) |
222 | 222 | if ending_data['id'] == 'add': |
... | ... | @@ -256,7 +256,7 @@ def update_pattern(request, form_data): |
256 | 256 | if len(lexemes) <= 100: |
257 | 257 | for l in lexemes: |
258 | 258 | l.refresh_data() |
259 | - if p.type.lexical_class.symbol == 'v': | |
259 | + if p.type.inflection_type_id == 'v': | |
260 | 260 | for l in p.lexeme_set.all(): |
261 | 261 | refresh_derivatives(l, request) |
262 | 262 | else: |
... | ... | @@ -270,7 +270,7 @@ def create_pattern(request): |
270 | 270 | i = 1 |
271 | 271 | while Pattern.all_objects.filter(name=new_name % i).exists(): |
272 | 272 | i += 1 |
273 | - pt = PatternType.objects.get(lexical_class_id='subst', symbol='m') | |
273 | + pt = PatternType.objects.get(inflection_type_id='subst', symbol='m') | |
274 | 274 | p = Pattern.objects.create( |
275 | 275 | name=new_name % i, type=pt, example='...', status=Pattern.STATUS_NEW, |
276 | 276 | deleted=True) |
... | ... |
patterns/models.py
... | ... | @@ -21,15 +21,15 @@ class InflectionType(Model): |
21 | 21 | |
22 | 22 | class BaseFormLabel(Model): |
23 | 23 | symbol = CharField(max_length=32, blank=True, db_column='efobaz') |
24 | - lexical_class = ForeignKey(InflectionType) | |
24 | + inflection_type = ForeignKey(InflectionType) | |
25 | 25 | index = IntegerField() |
26 | 26 | |
27 | 27 | def __unicode__(self): |
28 | - return '%s/%s' % (self.symbol, self.lexical_class.symbol) | |
28 | + return '%s/%s' % (self.symbol, self.inflection_type.symbol) | |
29 | 29 | |
30 | 30 | class Meta: |
31 | 31 | db_table = 'efobazy' |
32 | - unique_together = ['symbol', 'lexical_class'] | |
32 | + unique_together = ['symbol', 'inflection_type'] | |
33 | 33 | ordering = ['index'] |
34 | 34 | |
35 | 35 | |
... | ... | @@ -42,7 +42,7 @@ class DummyEnding(object): |
42 | 42 | |
43 | 43 | |
44 | 44 | class PatternType(Model): |
45 | - lexical_class = ForeignKey( | |
45 | + inflection_type = ForeignKey( | |
46 | 46 | InflectionType, db_column='czm', verbose_name=_(u'inflection type')) |
47 | 47 | # typ wzoru (np. dla rzeczownikรณw: odmiana mฤska, ลผeลska lub nijaka) |
48 | 48 | symbol = CharField( |
... | ... | @@ -52,7 +52,7 @@ class PatternType(Model): |
52 | 52 | |
53 | 53 | def dummy_base_endings(self): |
54 | 54 | bfl_dict = dict( |
55 | - (bfl, [DummyEnding(bfl.symbol or self.lexical_class_id)]) | |
55 | + (bfl, [DummyEnding(bfl.symbol or self.inflection_type_id)]) | |
56 | 56 | for bfl in self.base_form_labels.all()) |
57 | 57 | return bfl_dict |
58 | 58 | |
... | ... | @@ -60,12 +60,13 @@ class PatternType(Model): |
60 | 60 | def options(cls): |
61 | 61 | pattern_types = GroupDict() |
62 | 62 | for pt in cls.objects.all(): |
63 | - pattern_types.add(pt.lexical_class.symbol, (pt.id, unicode(pt))) | |
63 | + pattern_types.add(pt.inflection_type_id, (pt.id, unicode(pt))) | |
64 | 64 | return sorted(pattern_types.items()) |
65 | 65 | |
66 | 66 | def __unicode__(self): |
67 | - return self.symbol.replace('"', "''") or '[%s]' % self.lexical_class_id | |
68 | - # '%s (%s)' % (self.symbol, self.lexical_class_id) | |
67 | + return self.symbol.replace('"', "''") or \ | |
68 | + '[%s]' % self.inflection_type_id | |
69 | + # '%s (%s)' % (self.symbol, self.inflection_type_id) | |
69 | 70 | |
70 | 71 | class Meta: |
71 | 72 | db_table = 'typywzorow' |
... | ... | @@ -161,9 +162,9 @@ class Pattern(Model): |
161 | 162 | if gender: |
162 | 163 | bfl = gender.basic_form_label |
163 | 164 | basic_endings = self.endings.filter(base_form_label=bfl) |
164 | - elif self.type.lexical_class.symbol == 'v': | |
165 | + elif self.type.inflection_type_id == 'v': | |
165 | 166 | basic_endings = self.endings.filter(base_form_label__symbol='5') |
166 | - elif self.type.lexical_class.symbol == 'num': | |
167 | + elif self.type.inflection_type_id == 'num': | |
167 | 168 | basic_endings = self.endings.filter( |
168 | 169 | base_form_label__symbol__in=('1', '1,z1')) |
169 | 170 | else: |
... | ... |
patterns/static/js/pattern-reader-view.js
patterns/static/js/pattern-view.js
... | ... | @@ -6,7 +6,7 @@ var eqne = ['in', '-in']; |
6 | 6 | var column_names = { |
7 | 7 | name: gettext("name"), |
8 | 8 | type: gettext("type"), |
9 | - lexical_class: gettext("infl. type"), | |
9 | + inflection_type: gettext("infl. type"), | |
10 | 10 | example: gettext("example") |
11 | 11 | }; |
12 | 12 | |
... | ... | @@ -35,11 +35,11 @@ $.extend(slickgrid, { |
35 | 35 | filter_fields: { |
36 | 36 | 'name': {name: gettext("Name"), gender: 'f', ops: text_ops}, |
37 | 37 | 'old_name': {name: gettext("Old name"), gender: 'f', ops: text_ops}, |
38 | - 'lexical_class': { | |
38 | + 'inflection_type': { | |
39 | 39 | name: gettext("Inflection type"), |
40 | 40 | gender: 'm', |
41 | 41 | ops: eqne, |
42 | - options: $dj.lexical_class_options | |
42 | + options: $dj.inflection_type_options | |
43 | 43 | }, |
44 | 44 | 'type': { |
45 | 45 | name: gettext("Type"), |
... | ... |
patterns/templates/pattern_preview.html
1 | 1 | {% load i18n %} |
2 | -<div class="entry-article scheme{{ pattern.type.lexical_class.color_scheme }}"> | |
2 | +<div class="entry-article scheme{{ pattern.type.inflection_type.color_scheme }}"> | |
3 | 3 | <div class="article-header"> |
4 | 4 | <h1> |
5 | 5 | {{ pattern.name }} |
6 | 6 | </h1> |
7 | - <p>{{ pattern.type.lexical_class.full_name }}</p> | |
7 | + <p>{{ pattern.type.inflection_type.full_name }}</p> | |
8 | 8 | <p>{% trans 'Type' %}: {{ pattern.type.symbol }}</p> |
9 | 9 | <p> |
10 | 10 | {% if detailed_counts %} |
... | ... |
patterns/views.py
... | ... | @@ -8,8 +8,8 @@ from patterns.ajax_pattern_view import PatternQuery |
8 | 8 | |
9 | 9 | |
10 | 10 | def common_pattern_js_vars(request, reader=False): |
11 | - lexical_class_options = [ | |
12 | - (lc.symbol, lc.symbol) for lc in InflectionType.objects.all()] | |
11 | + inflection_type_options = [ | |
12 | + (it.symbol, it.symbol) for it in InflectionType.objects.all()] | |
13 | 13 | base_form_labels = dict( |
14 | 14 | (pt.id, list(pt.base_form_labels.values_list('id', flat=True))) |
15 | 15 | for pt in PatternType.objects.all()) |
... | ... | @@ -20,7 +20,7 @@ def common_pattern_js_vars(request, reader=False): |
20 | 20 | 'ajax_row_index': reverse('patterns_row_index'), |
21 | 21 | 'ajax_pattern_preview': reverse('pattern_preview'), |
22 | 22 | 'ajax_get_name': reverse('get_name'), |
23 | - 'lexical_class_options': lexical_class_options, | |
23 | + 'inflection_type_options': inflection_type_options, | |
24 | 24 | 'pattern_type_options': PatternType.options(), |
25 | 25 | 'base_form_labels': base_form_labels, |
26 | 26 | 'bfl_symbols': bfl_symbols, |
... | ... |
skrypty/filter_forms.py
... | ... | @@ -30,25 +30,25 @@ def test_other(tag): |
30 | 30 | test_subst(tag) or test_v(tag) or test_ndm(tag) or test_adj(tag)) |
31 | 31 | |
32 | 32 | |
33 | -def test(lc, tag): | |
34 | - if lc == 'subst': | |
33 | +def test(it, tag): | |
34 | + if it == 'subst': | |
35 | 35 | return test_subst(tag) |
36 | - elif lc == 'v': | |
36 | + elif it == 'v': | |
37 | 37 | return test_v(tag) |
38 | - elif lc == 'ndm': | |
38 | + elif it == 'ndm': | |
39 | 39 | return test_ndm(tag) |
40 | - elif lc == 'adj': | |
40 | + elif it == 'adj': | |
41 | 41 | return test_adj(tag) |
42 | - elif lc == 'other': | |
42 | + elif it == 'other': | |
43 | 43 | return test_other(tag) |
44 | 44 | else: |
45 | - return tag.startswith(lc) | |
45 | + return tag.startswith(it) | |
46 | 46 | |
47 | 47 | |
48 | 48 | if __name__ == '__main__': |
49 | 49 | import sys |
50 | 50 | |
51 | - lc = sys.argv[1] | |
51 | + it = sys.argv[1] | |
52 | 52 | with open(sys.argv[2]) as file: |
53 | 53 | state = 'query' |
54 | 54 | negated = [] |
... | ... | @@ -65,7 +65,7 @@ if __name__ == '__main__': |
65 | 65 | state = 'query' |
66 | 66 | elif state == 'query': |
67 | 67 | tag = line.split('\t')[1] |
68 | - if test(lc, tag): | |
68 | + if test(it, tag): | |
69 | 69 | print line |
70 | 70 | state = 'print' |
71 | 71 | else: |
... | ... |
tables/management/commands/export_template.py
... | ... | @@ -21,10 +21,10 @@ def export_template(tt): |
21 | 21 | else: |
22 | 22 | data['export_cells'] = [] |
23 | 23 | table_cells = tt.table_cells.select_related( |
24 | - 'base_form_label__lexical_class').prefetch_related( | |
24 | + 'base_form_label__inflection_type').prefetch_related( | |
25 | 25 | 'pattern_types', 'attribute_values') |
26 | 26 | export_cells = tt.export_cells.select_related( |
27 | - 'base_form_label__lexical_class').prefetch_related( | |
27 | + 'base_form_label__inflection_type').prefetch_related( | |
28 | 28 | 'pattern_types', 'attribute_values') |
29 | 29 | headers = tt.headers.prefetch_related( |
30 | 30 | 'pattern_types', 'attribute_values') |
... | ... | @@ -34,7 +34,7 @@ def export_template(tt): |
34 | 34 | for elem_type, elem in table_elements: |
35 | 35 | data_row = { |
36 | 36 | 'pattern_types': list( |
37 | - elem.pattern_types.values_list('symbol', 'lexical_class_id')), | |
37 | + elem.pattern_types.values_list('symbol', 'inflection_type_id')), | |
38 | 38 | 'attr_vals': list(elem.attribute_values.values_list( |
39 | 39 | 'value', 'attribute__name')), |
40 | 40 | } |
... | ... | @@ -51,7 +51,7 @@ def export_template(tt): |
51 | 51 | if elem_type in ('table_cells', 'export_cells'): |
52 | 52 | data_row.update({ |
53 | 53 | 'bfl': (elem.base_form_label.symbol, |
54 | - elem.base_form_label.lexical_class.symbol), | |
54 | + elem.base_form_label.inflection_type_id), | |
55 | 55 | 'prefix': elem.prefix, |
56 | 56 | 'suffix': elem.suffix, |
57 | 57 | }) |
... | ... |
tables/management/commands/export_templates.py
... | ... | @@ -20,7 +20,7 @@ def export_templates(): |
20 | 20 | data_row['parts_of_speech'] = list( |
21 | 21 | tt.parts_of_speech.values_list('symbol', flat=True)) |
22 | 22 | data_row['pattern_types'] = list( |
23 | - tt.pattern_types.values_list('symbol', 'lexical_class_id')) | |
23 | + tt.pattern_types.values_list('symbol', 'inflection_type_id')) | |
24 | 24 | data_row['attributes'] = list( |
25 | 25 | tt.attributes.values_list('name', flat=True)) |
26 | 26 | data_row['attribute_values'] = list( |
... | ... |
tables/management/commands/import_template.py
... | ... | @@ -14,7 +14,7 @@ class Command(BaseCommand): |
14 | 14 | import_template(json.load(open(filename))) |
15 | 15 | |
16 | 16 | PATTERN_TYPES = dict( |
17 | - ((pt.symbol, pt.lexical_class.symbol), pt) | |
17 | + ((pt.symbol, pt.inflection_type_id), pt) | |
18 | 18 | for pt in PatternType.objects.all()) |
19 | 19 | |
20 | 20 | GENDERS = dict((g.symbol, g) for g in Gender.objects.all()) |
... | ... | @@ -24,7 +24,7 @@ ATTR_VALS = dict( |
24 | 24 | for av in LexemeAttributeValue.objects.all()) |
25 | 25 | |
26 | 26 | BFLS = dict( |
27 | - ((bfl.symbol, bfl.lexical_class.symbol), bfl) | |
27 | + ((bfl.symbol, bfl.inflection_type_id), bfl) | |
28 | 28 | for bfl in BaseFormLabel.objects.all()) |
29 | 29 | |
30 | 30 | |
... | ... |
tables/management/commands/import_templates.py
... | ... | @@ -16,7 +16,7 @@ class Command(BaseCommand): |
16 | 16 | import_templates(json.load(open(filename))) |
17 | 17 | |
18 | 18 | PATTERN_TYPES = dict( |
19 | - ((pt.symbol, pt.lexical_class.symbol), pt) | |
19 | + ((pt.symbol, pt.inflection_type_id), pt) | |
20 | 20 | for pt in PatternType.objects.all()) |
21 | 21 | |
22 | 22 | ATTRS = dict((attr.name, attr) for attr in LexemeAttribute.objects.all()) |
... | ... |