Seedlings_ is a project created by Qianxun Chen. It is an experimental web interface to explore the artistic value of algorithmic correlations of words in data driven text analysis. Words are planted as seeds and grow into different ‘plants’ with the help of Datamuse API. It is at once an ambient piece in which words and concepts are dislocated and recontextualized constantly, and a playground for the user to create linguistic immigrants and textual nomads.
You can find a demo here.(Best Viewed in Chrome)
Technical Breakdown of the project
- API: Datamuse
- Back end: Python Flask Framework
- Front end: d3.js
The following sections will be covered in the workshop.
Intro to datamuse, how to use the datamuse API
More about Seedlings_
Build Seedlings_ as a web app (?)
- 1.1 What is datamuse
- 1.2 How to use datamuse?
- 1.3 APIs used in Seedlings_
- 2.1 Defining Plants
- 2.2 Visualization
- 2.3 Interface
- 3.1 What is d3.js
- 3.2 A basic visualization example
- How Seedlings_ works
- 4.1 Setups for seedlings
- 4.2 Plant from the Command Line!
- 4.3 Plant server using flask
- 4.4 PythonAnywhere
“The Datamuse API is a word-finding query engine for developers. You can use it in your apps to find words that match a given set of constraints and that are likely in a given context. ”
Major Data sources
- Corpus-based data:The Google Books Ngrams data set,to build the language model that scores candidate words by context
- Semantic knowledge: word2vec, Paraphrase Database, WordNet 3.0
- Phonetic data: The CMU pronouncing dictionary
You can access most of the features of the API at the URL api.datamuse.com/words, with the query parameters described below.
|Adjectives that are often used to describe ocean
|Adjectives describing ocean sorted by how related they are to temperature
|Nouns that are often described by the adjective yellow
|Frequent followers of hope
|Words with a meaning similar to perished
|"Triggers" (words that are statistically associated with pain in the same piece of text.)
|Antonyms of loud)
|Words that start with t, end in k, and have two letters in between
|Nouns(ml) <-> Adjectives(ml)
|Triggers of word in context
|Adjectives that are often used to describe context + word
|A sequence of Frequent followers(rel_bga)
|A list of words that start and end with the same letters as word in context
|A sequence of words that ends with the first letter of the previous word in context
|A list of words that rythm with the given word
Check here to play with Seedlings_.(Best Viewed in Chrome)
- SVG stands for Scalable Vector Graphics
- It is used to define graphics for the Web. It is not a direct image, but a way to create images following instructions. As its name suggests, it scales itself according to the size of the browser, so resizing your browser will not distort the image. All browsers support SVG except IE 8 and below. D3.js provides convenient tools to manipulate SVG.
- Difference between Canvas and SVG: Canvas is pixel-oriented. Once the pixels hit the screen, you cannot change shapes except by overwriting them with other pixels. However, SVG is like a "draw" program, its graphical elements become part of the DOM. Any part of any shape can be changed through script and CSS.
In d3Example you can find an interactive visualization of adjective/noun relationships in English. It was made using the "rel_jjb" and "rel_jja" queries in datamuse API, and the D3 force layout.
Modify the code to create your own linguistic plant!
Beautiful intro to python documentation by Sam Lavigne
Open terminal on MacOS, and type in the following and hit enter.
We are using python3 in this case
pip is a tool to install python library. If you are on MacOS, open terminal, using command line:
sudo easy_install pip
You will be asked for your mac password, type it and hit enter. You can also follow the install guide here.
virtualenv creates isolated python environments tied to specific projects. f
sudo pip install virtualenv
Create a new project folder "your_project_name", and cd(change directory) to this folder on terminal.
In terminal, type in the following to create a virtual environment for this project and activate it
You should see (env) at the front of the current line in terminal.
- datamuse, nltk, flask
pip3 install -r requirements.txt
To see demo from all plant types:
python plant.py demo
An example of a generative chain:
python plant.py test
Plant specific seedlings with the following syntax: "plant --word(noun or adjective) in --domain as --plantType"
python plant.py soft in postmodernism as plant
FLASK_APP=plant_server.py flask run