Wordtree Generator


How branchy do you want the network to look?

Seed words:

each phrase quoted, commas separated, in square brackets like ["ham","cheese","olive oil"] -- or leave blank

Parse by sentence/paragraph or adjacent words:
 

Options if you use the API version, at /wordtree/api/

  • 'data': string (required) -- text to mine
  • 'viz': 1 / 0 or True/False (returns JSON if Talse, or URL to VIZ if True)
  • 'hideNav': True/False
  • 'height': INT
  • 'branchType': branchy / mid / sparse / dynamic
  • 'branching': INT
  • 'returnNest': if True, sends back a structured dictionary. If False, returns gexf file (and if viz==0). Default:False
  • 'depth': 2 to 5 INT
  • 'wordlist': LIST of seed words
  • 'orgname': to seed in org-centered chart

To unpack this JSON, you'll need to convert the keys into tuples of strings like this (in python):

    >>> import requests as R
    >>> result = R.post('http://storylearning.org/wordtree/api/',params={'viz':0,'returnNest':True, 'data': your_text_string})
    >>> data = result.json() # keys in this JSON are not unpacked yet, because too complex.
    >>> from ast import literal_eval
    >>> data['data'] = {literal_eval(k):v for k,v in data['data'].items()}
    

To supply a list of seed words with your input, do this:

    >>> import requests
    >>> msg = requests.post('http://storylearning.org/wordtree/api/',
        data={'data':bigstring,
                'viz':True,
                'wordList':'["financial","cost","financing","support"]',
                'orgName':None, 
                'branchType':'dynamic', #depends on length of string
                'branching':8,
                'returnNest':False,
                'depth':3
              })
    >>> print msg.url
    
Where wordList is a string containing a well-formed python list. You need to quote each term and escape your quotes. Supplying orgName as a single string, keyword, connects all the top-level terms to this keyword at the center of the map.