Commit 0097e083 authored by vpodpecan's avatar vpodpecan

new MUSE v3 widget(s)

parent 78adb390
import re
import subprocess
import logging
try:
from ladon.clients.jsonwsp import JSONWSPClient
except ImportError:
logging.warning('Ladon package not available, most of MUSE stuff will not work.')
def MUSE_v3_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 MUSE_v3_sum_integers(input_dict):
intList = input_dict['intList']
return {'sum':sum(intList)}
def MUSE_v3_pre_filter_integers(input_dict):
return input_dict
def MUSE_preprocessing(input_dict):
url = input_dict['url']
text = input_dict['text']
def MUSE_v3_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}
import socket
socket.setdefaulttimeout(None)
cli = JSONWSPClient(url)
result = cli.preprocessing(text=text)
tokens = result.response_dict['result']
return {'tokens': tokens}
#end
def MUSE_v3_pre_display_summation(input_dict):
return {}
\ No newline at end of file
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