From 990d042c3d0c5099ebcbcf6cf34b4d1b9eff16a0 Mon Sep 17 00:00:00 2001 From: Tomasz Bartosiak <tomasz.bartosiak@gmail.com> Date: Tue, 28 Aug 2018 17:37:50 +0200 Subject: [PATCH] Poprawka przy infps --- semantics/phraseology_generator.py | 3 ++- semantics/views.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/semantics/phraseology_generator.py b/semantics/phraseology_generator.py index 9874942..a3a8e99 100644 --- a/semantics/phraseology_generator.py +++ b/semantics/phraseology_generator.py @@ -184,12 +184,13 @@ def get_infps(aspect, verbs, atr): if u'inf:' in tag: filtered.append(option) options = filtered + filtered = [] if aspect != u'_': for option in options: (orth, tag) = option if in_tag(aspect, tag): filtered.append(option) - options = filtered + options = filtered result += options return dependents(atr, result) diff --git a/semantics/views.py b/semantics/views.py index 8ce167f..7194861 100644 --- a/semantics/views.py +++ b/semantics/views.py @@ -453,7 +453,7 @@ def ajax_roles(request): @render('schemas.json') @ajax(method='get', encode_result=False) def ajax_schemas(request, lemma_id): - + lemma = Lemma.objects.get(id=lemma_id).entry_obj.actual_lemma() schemas_all = lemma.frames.all() @@ -478,9 +478,11 @@ def ajax_schemas(request, lemma_id): characteristics[characteristic_id] = "(%s)" % (','.join(values[1:])) schemas_by_characteristic[characteristic_id] = [] schemas_by_characteristic[characteristic_id].append(schema) - + lexical_units = lemma.entry_obj.meanings.all() + i = 0 + schemas_display = [] schema_unit_rank = {} for characteristic_id in characteristics_ids: @@ -488,6 +490,7 @@ def ajax_schemas(request, lemma_id): schemas = schemas_by_characteristic[characteristic_id] for schema in schemas: # row by row display for schema tables + ordered_positions = sort_positions(schema.positions.all()) # classes and first frame/position part of identifiers schema_ids = [u'schema_' + str(schema.id) + '_pos_' + str(position.id) + '_' for position in ordered_positions] @@ -499,8 +502,8 @@ def ajax_schemas(request, lemma_id): schema_arguments_rowspan = max(max([position.arguments.count() for position in ordered_positions] + [0]), 1) display = {"categories": [{"csv_id": c, "csv_class": c, "argument": a} for c, a in schema_categories], "arguments": []} - for i in range(schema_arguments_rowspan): + for i in range(schema_arguments_rowspan): row = [] idents = [] for schema_id, position in zip(schema_ids, ordered_positions): @@ -513,7 +516,7 @@ def ajax_schemas(request, lemma_id): idents.append(schema_id + 'arg_-' + str(i + 1) + '_') # identifier, class, argument arg = [] - #ma["ala"] = kot + for i, c, a, p in zip(idents, schema_ids, row, ordered_positions): astr, aobj = a if aobj is not None and aobj.is_phraseologic(): @@ -523,7 +526,7 @@ def ajax_schemas(request, lemma_id): lex, vrb, loc = ([], [], 0) arg.append({"csv_id": i, "csv_class": c, "argument": astr, "lex": lex, "vrb": vrb, "loc": loc}) display["arguments"].append(arg) - + schema_display["schemas"].append({"schema_id": str(schema.id), "grade": lemma.get_schema_opinion(schema), "colspan": str(max(len(schema_categories), 1)), "rowspan": str(schema_arguments_rowspan), "display": display, "phraseologic": schema.phraseologic}) ranks = FrameRankings.objects.filter(frame=schema) -- libgit2 0.22.2