def generate_term_cloud(terms_list, words): import fietstas_rest from fietstas_rest import Fietstas doc = "" terms = [x[0] for x in terms_list] weights = [x[1] for x in terms_list] for i in range(0, min(words,len(terms))): for j in range(0, weights[i]): doc += (terms[i] + " ") f = Fietstas(key='demo-key') doc_id = f.upload_document(document = doc) cloud_link, cloud = f.make_cloud(docs=doc_id, words = words) return cloud_link
def generate_term_cloud(terms_list, words): import fietstas_rest from fietstas_rest import Fietstas doc = "" terms = [x[0] for x in terms_list] weights = [x[1] for x in terms_list] for i in range(0, min(words,len(terms))): for j in range(0, weights[i]): doc += (terms[i] + " ") f = Fietstas(key='0ce798c52985460e9b79dbb23812fc42') doc_id = f.upload_document(document = doc) cloud_link, cloud = f.make_cloud(docs=doc_id, words = words, stopwords = 1) if cloud is None: # Cloud is not available yet: wait in a loop for i in range(10): time.sleep(2) cloud = f.get_cloud(cloud_link) if cloud is not None: break return cloud, cloud_link