Commit 2fdf6402 authored by Anze Vavpetic's avatar Anze Vavpetic
Browse files

added aleph widget.

parent f47a0b83
import aleph as __aleph_pkg from aleph import aleph
__aleph_pkg.DEBUG = False \ No newline at end of file
# Create an aleph instance
runner = __aleph_pkg.Aleph()
\ No newline at end of file
...@@ -104,7 +104,6 @@ class Aleph(object): ...@@ -104,7 +104,6 @@ class Aleph(object):
return rules return rules
def __prepare(self, filestem, pos, neg, b): def __prepare(self, filestem, pos, neg, b):
""" """
Prepares the needed files. Prepares the needed files.
...@@ -161,3 +160,5 @@ class Aleph(object): ...@@ -161,3 +160,5 @@ class Aleph(object):
cat(self.postGoal + ".") cat(self.postGoal + ".")
cat(self.postScript) cat(self.postScript)
script.close() script.close()
aleph = Aleph()
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
def ilp_filter_integers(request,input_dict,output_dict,widget):
return render(request, 'interactions/ilp_filter_integers.html',{'widget':widget,'intList':input_dict['intList']})
\ No newline at end of file
import re import re
from string import ascii_uppercase as chars, digits
from random import choice
def ilp_create_integers(input_dict): from aleph import aleph
intStr = input_dict['intStr']
intList = []
for i in re.findall(r'\w+', intStr):
if input_dict['sort'].lower() == "true":
return {'intList':intList}
def ilp_sum_integers(input_dict):
intList = input_dict['intList']
return {'sum':sum(intList)}
def ilp_pre_filter_integers(input_dict):
return input_dict
def ilp_post_filter_integers(postdata,input_dict,output_dict):
intListOut = postdata['intListOut']
intList = []
for i in intListOut:
return {'intList': intList}
def ilp_pre_display_summation(input_dict):
return {}
def ilp_pre_aleph(input_dict): def ilp_pre_aleph(input_dict):
return input_dict return input_dict
def ilp_post_aleph(postdata, input_dict, output_dict): def ilp_post_aleph(postdata, input_dict, output_dict):
settings = input_dict['settings']
mode = input_dict['mode']
pos = input_dict['pos']
neg = input_dict['neg']
b = input_dict['b']
# Random 10 character experiment id.
eid = ''.join(choice(chars + digits) for i in range(10))
result = aleph.induce(mode, eid, pos, neg, b)
return {'result' : result} return {'result' : result}
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
def ilp_display_summation(request,input_dict,output_dict,widget):
if sum(input_dict['intList']) == input_dict['sum']:
check = 'The calculation appears correct.'
check = 'The calculation appears incorrect!'
return render(request, 'visualizations/ilp_display_integers.html',{'widget':widget,'input_dict':input_dict, 'output_dict':output_dict, 'check':check})
Supports Markdown
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