Committing non-working code that breaks go workflow. ;)
This commit is contained in:
parent
6f050d4f10
commit
fa047e0171
|
@ -132,6 +132,53 @@ class LoadGOFunction(workflow.Function):
|
||||||
fluents.app['bottom_notebook'].append_page(browser, label)
|
fluents.app['bottom_notebook'].append_page(browser, label)
|
||||||
|
|
||||||
|
|
||||||
|
class LoadTextDatasetFunction(workflow.Function):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
workflow.Function.__init__(self, 'load-text-ds', 'Load text dataset')
|
||||||
|
|
||||||
|
def read_text_dataset(self, fd):
|
||||||
|
split_re = re.compile('^#\s*(\w+)\s*:\s*(.)')
|
||||||
|
dimensions = []
|
||||||
|
identifiers = {}
|
||||||
|
type = 'dataset'
|
||||||
|
name = 'Unnamed dataset'
|
||||||
|
|
||||||
|
# Read header lines from file.
|
||||||
|
line = fd.readline()
|
||||||
|
while line:
|
||||||
|
m = split_re.match(line)
|
||||||
|
if m:
|
||||||
|
key, val = m
|
||||||
|
|
||||||
|
# The line is on the form;
|
||||||
|
# dimension: dimname id1 id2 id3 ...
|
||||||
|
if key == 'dimension':
|
||||||
|
values = [v.strip() for v in val.split(' ')
|
||||||
|
dimensions.append(values[0])
|
||||||
|
identifiers[values[0]] = values[1:]
|
||||||
|
|
||||||
|
headers[key] = val.strip()
|
||||||
|
|
||||||
|
# Read type of dataset.
|
||||||
|
# Should be dataset, category, or network
|
||||||
|
elif key == 'type':
|
||||||
|
type = val
|
||||||
|
|
||||||
|
elif key == 'name':
|
||||||
|
name = val
|
||||||
|
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
line = f.readline()
|
||||||
|
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
f = open('/home/einarr/foodata.tds')
|
||||||
|
return read_text_dataset(f)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LoadAnnotationsFunction(workflow.Function):
|
class LoadAnnotationsFunction(workflow.Function):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
Reference in New Issue