Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alain Shakour
clowdflows
Commits
2fdf6402
Commit
2fdf6402
authored
Dec 18, 2012
by
Anze Vavpetic
Browse files
added aleph widget.
parent
f47a0b83
Changes
5
Hide whitespace changes
Inline
Side-by-side
workflows/ilp/aleph/__init__.py
View file @
2fdf6402
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
workflows/ilp/aleph/aleph.py
View file @
2fdf6402
...
...
@@ -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
workflows/ilp/interaction_views.py
View file @
2fdf6402
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
workflows/ilp/library.py
View file @
2fdf6402
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
workflows/ilp/visualization_views.py
View file @
2fdf6402
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
})
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment