Esempio n. 1
0
def synset_by_id(id):

    synset = Synset.query.get(id)
    synset_history = find_synset_history(id)

    incoming_rel = find_synset_incoming_relations(id)
    incoming_history = TrackerSynsetsRelationsHistory.query.filter(
        TrackerSynsetsRelationsHistory.target_id == id).all()

    outgoing_rel = find_synset_outgoing_relations(id)
    outgoing_history = TrackerSynsetsRelationsHistory.query.filter(
        TrackerSynsetsRelationsHistory.source_id == id).all()

    senses = find_synset_senses(id)
    senses_history = find_synset_sense_history(id)

    return render_template('synset/synset.html',
                           status=status(),
                           pos=parts_of_speech(),
                           incoming_rel=incoming_rel,
                           outgoing_rel=outgoing_rel,
                           outgoing_history=outgoing_history,
                           incoming_history=incoming_history,
                           senses_history=senses_history,
                           senses=senses,
                           synset=synset,
                           synset_history=synset_history,
                           keycloak=KeycloakServiceClient())
Esempio n. 2
0
def sense_by_id(id):

    sense = Sense.query.get(id)
    sense_hist = find_sense_history(id)

    incoming_rel = find_sense_incoming_relations(id)
    incoming_history = TrackerSenseRelationsHistory.query.filter(
        TrackerSenseRelationsHistory.target_id == id).all()

    outgoing_rel = find_sense_outgoing_relations(id)
    outgoing_history = TrackerSenseRelationsHistory.query.filter(
        TrackerSenseRelationsHistory.source_id == id).all()

    emotions = Emotion.query.filter(Emotion.sense_id == id).all()

    return render_template('sense/sense.html',
                           sense=sense,
                           pos=parts_of_speech(),
                           domain=domain(),
                           status=status(),
                           aspect=aspect(),
                           sense_history=sense_hist,
                           incoming_rel=incoming_rel,
                           outgoing_rel=outgoing_rel,
                           outgoing_history=outgoing_history,
                           incoming_history=incoming_history,
                           emotions=emotions)
Esempio n. 3
0
def sense_by_id(id):

    sense = Sense.query.get(id)
    sense_hist = find_sense_history(id)

    incoming_rel = find_sense_incoming_relations(id)
    incoming_history = TrackerSenseRelationsHistory.query.filter(TrackerSenseRelationsHistory.target_id == id).all()

    outgoing_rel = find_sense_outgoing_relations(id)
    outgoing_history = TrackerSenseRelationsHistory.query.filter(TrackerSenseRelationsHistory.source_id == id).all()

    emotions = Emotion.query.filter(Emotion.sense_id == id).all()
    for e in emotions:
        if e.emotions is None:
            e.emotions = ''
        if e.valuations is None:
            e.valuations = ''
        if e.markedness is None:
            e.markedness = ''

    morpho = Morphology.query.filter(Morphology.lexicalunit_id == id).all()

    return render_template(
        'sense/sense.html',
        sense=sense,
        pos=parts_of_speech(),
        domain=domain(),
        status=status(),
        aspect=aspect(),
        sense_history=sense_hist,
        incoming_rel=incoming_rel,
        outgoing_rel=outgoing_rel,
        outgoing_history=outgoing_history,
        incoming_history=incoming_history,
        emotions=emotions,
        morpho=morpho,
        keycloak=KeycloakServiceClient()
    )
Esempio n. 4
0
def senses_history(page):

    filter_form = SenseHistoryForm()
    users = get_user_name_list()

    paginated_senses = TrackerSenseHistory.query.filter(
        TrackerSenseHistory.search_by_form_filter(
            request.args.get('date_from', ''),
            request.args.get('date_to', ''),
            request.args.get('sense_id', ''),
            request.args.get('user', ''),
            request.args.get('pos', ''),
            request.args.get('status', '')
        )
    )
    cache_key = 'luh-count-{}_{}_{}_{}_{}_{}'.format(
        request.args.get('date_from', ''),
        request.args.get('date_to', ''),
        request.args.get('sense_id', ''),
        request.args.get('pos', ''),
        request.args.get('status', ''),
        request.args.get('user', '')
    )

    pagination = paginate(paginated_senses, page, 50, cache_key)

    return render_template(
        'sense/sense-history.html',
        form=filter_form,
        users=users,
        sense_history=pagination,
        status=status(),
        pos=parts_of_speech(),
        domain=domain(),
        keycloak=KeycloakServiceClient()
    )