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

added aleph widget.

parent f47a0b83
import aleph as __aleph_pkg
__aleph_pkg.DEBUG = False
# Create an aleph instance
runner = __aleph_pkg.Aleph()
\ No newline at end of file
from aleph import aleph
\ No newline at end of file
......@@ -104,7 +104,6 @@ class Aleph(object):
return rules
def __prepare(self, filestem, pos, neg, b):
"""
Prepares the needed files.
......@@ -161,3 +160,5 @@ class Aleph(object):
cat(self.postGoal + ".")
cat(self.postScript)
script.close()
aleph = Aleph()
\ No newline at end of file
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
from string import ascii_uppercase as chars, digits
from random import choice
def ilp_create_integers(input_dict):
intStr = input_dict['intStr']
intList = []
for i in re.findall(r'\w+', intStr):
try:
intList.append(int(i))
except:
pass
if input_dict['sort'].lower() == "true":
intList.sort()
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:
try:
intList.append(int(i))
except:
pass
return {'intList': intList}
def ilp_pre_display_summation(input_dict):
return {}
from aleph import aleph
def ilp_pre_aleph(input_dict):
return input_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}
\ No newline at end of file
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.'
else:
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