Commit 717fd076 authored by Janez K's avatar Janez K
Browse files

Merge branch 'dev' into svg

parents c2e199f4 10af7889
{% extends "base.html" %}
{% load url from future %}
{% block body %}
You've been logged out! <br> <a href="{% url 'website index' %}">Proceed</a>
{% endblock %}
{% extends "base.html" %}
{% load url from future %}
{% block body %}
{% if form.errors %}
<p>Narobe username pa password alo!</p>
{% endif %}
<form method="post" action="{% url 'django.contrib.auth.views.login' %}">
{% csrf_token %}
{{ form.username.label_tag }}
{{ form.username }}
{{ form.password.label_tag }}
{{ form.password }}
<input type="submit" value="login">
<input type="hidden" name="next" value="{{ next }}">
</form>
{% endblock %}
{% extends "base.html" %}
{% load url from future %}
{% block body %}
Password change done!
<a href="{% url 'the index' %}">Go home</a>
{% endblock %}
{% extends "base.html" %}
{% load url from future %}
{% block body %}
This is the password change form.
<form method="post" action="{% url 'password change' %}">
{% csrf_token %}
{{ form.old_password.label_tag }}
{{ form.old_password }} {{ form.old_password.errors }}<br>
{{ form.new_password1.label_tag }}
{{ form.new_password1 }} {{ form.new_password1.errors }} <br>
{{ form.new_password2.label_tag }}
{{ form.new_password2 }} {{ form.new_password2.errors }}<br>
<input type="submit" value="login">
</form>
{% endblock body %}
...@@ -805,16 +805,23 @@ def merge_sentences(input_dict): ...@@ -805,16 +805,23 @@ def merge_sentences(input_dict):
""" """
method = input_dict['method'] method = input_dict['method']
merged_sen, id_to_sent = set(), {} merged_sen, id_to_sent = set(), {}
ids_list = []
for sentsXML in input_dict['sentences']: for sentsXML in input_dict['sentences']:
sents = nlp.parse_def_sentences(sentsXML) sents = nlp.parse_def_sentences(sentsXML)
ids = set(map(lambda x: x['id'], sents)) ids = set(map(lambda x: x['id'], sents))
ids_list.append(ids)
# Save the map from id to sentence # Save the map from id to sentence
for sent in sents: for sent in sents:
id_to_sent[sent['id']] = sent id_to_sent[sent['id']] = sent
if len(merged_sen) == 0:
merged_sen = ids
if method == 'union': if method == 'union':
merged_sen = merged_sen | ids merged_sen = merged_sen | ids
elif method == 'intersection': elif method == 'intersection':
merged_sen = merged_sen & ids merged_sen = merged_sen & ids
elif method == 'intersection_two':
for ids_alt in ids_list:
merged_sen = merged_sen | (ids_alt & ids)
return {'merged_sentences' : nlp.sentences_to_xml([id_to_sent[sid] for sid in merged_sen])} return {'merged_sentences' : nlp.sentences_to_xml([id_to_sent[sid] for sid in merged_sen])}
def load_corpus(input_dict): def load_corpus(input_dict):
......
...@@ -3,9 +3,9 @@ import nlp ...@@ -3,9 +3,9 @@ import nlp
def odt_to_tab(request,input_dict,output_dict,widget): def odt_to_tab(request,input_dict,output_dict,widget):
import Orange import Orange
from settings import MEDIA_ROOT from mothra.settings import MEDIA_ROOT
from workflows.helpers import ensure_dir from workflows.helpers import ensure_dir
destination = MEDIA_ROOT+str(request.user.id)+'/'+str(widget.id)+'.tab' destination = MEDIA_ROOT+'/'+str(request.user.id)+'/'+str(widget.id)+'.tab'
ensure_dir(destination) ensure_dir(destination)
input_dict['data'].save(destination) input_dict['data'].save(destination)
filename = str(request.user.id)+'/'+str(widget.id)+'.tab' filename = str(request.user.id)+'/'+str(widget.id)+'.tab'
...@@ -14,9 +14,9 @@ def odt_to_tab(request,input_dict,output_dict,widget): ...@@ -14,9 +14,9 @@ def odt_to_tab(request,input_dict,output_dict,widget):
def odt_to_csv(request,input_dict,output_dict,widget): def odt_to_csv(request,input_dict,output_dict,widget):
import Orange import Orange
from settings import MEDIA_ROOT from mothra.settings import MEDIA_ROOT
from workflows.helpers import ensure_dir from workflows.helpers import ensure_dir
destination = MEDIA_ROOT+str(request.user.id)+'/'+str(widget.id)+'.csv' destination = MEDIA_ROOT+'/'+str(request.user.id)+'/'+str(widget.id)+'.csv'
ensure_dir(destination) ensure_dir(destination)
input_dict['data'].save(destination) input_dict['data'].save(destination)
filename = str(request.user.id)+'/'+str(widget.id)+'.csv' filename = str(request.user.id)+'/'+str(widget.id)+'.csv'
...@@ -25,9 +25,9 @@ def odt_to_csv(request,input_dict,output_dict,widget): ...@@ -25,9 +25,9 @@ def odt_to_csv(request,input_dict,output_dict,widget):
def odt_to_arff(request,input_dict,output_dict,widget): def odt_to_arff(request,input_dict,output_dict,widget):
import Orange import Orange
from settings import MEDIA_ROOT from mothra.settings import MEDIA_ROOT
from workflows.helpers import ensure_dir from workflows.helpers import ensure_dir
destination = MEDIA_ROOT+str(request.user.id)+'/'+str(widget.id)+'.arff' destination = MEDIA_ROOT+'/'+str(request.user.id)+'/'+str(widget.id)+'.arff'
ensure_dir(destination) ensure_dir(destination)
input_dict['data'].save(destination) input_dict['data'].save(destination)
filename = str(request.user.id)+'/'+str(widget.id)+'.arff' filename = str(request.user.id)+'/'+str(widget.id)+'.arff'
...@@ -35,9 +35,9 @@ def odt_to_arff(request,input_dict,output_dict,widget): ...@@ -35,9 +35,9 @@ def odt_to_arff(request,input_dict,output_dict,widget):
return render(request, 'visualizations/string_to_file.html',{'widget':widget,'input_dict':input_dict,'output_dict':output_dict}) return render(request, 'visualizations/string_to_file.html',{'widget':widget,'input_dict':input_dict,'output_dict':output_dict})
def string_to_file(request,input_dict,output_dict,widget): def string_to_file(request,input_dict,output_dict,widget):
from settings import MEDIA_ROOT from mothra.settings import MEDIA_ROOT
from workflows.helpers import ensure_dir from workflows.helpers import ensure_dir
destination = MEDIA_ROOT+str(request.user.id)+'/'+str(widget.id)+'.txt' destination = MEDIA_ROOT+'/'+str(request.user.id)+'/'+str(widget.id)+'.txt'
ensure_dir(destination) ensure_dir(destination)
f = open(destination,'w') f = open(destination,'w')
f.write(str(input_dict['string'])) f.write(str(input_dict['string']))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment