Meaningful Nonsense: How I generate sentences

I’m coding a system in JavaScript that generates sentences of “meaningful nonsense”. Here are some examples.

I set off on this path because I’m working on a series of generative diagrams and I wanted them to have titles. Immediately I was drawn in by the effect of the diagrams next to the semi-nonsensical words. Since then, I have developed these diagrams a lot, including using my sentence generating system to add scribbled notes to the sides of them.

Here’s an early example and one of where my diagrams are up to now.

 

I have also been using this system to generate “truths” and to provide content for typographical artworks. All of this is an ongoing experimental work in progress but I’d like to share how it works so far.

 

Sentence Structures

My system consists of sentence structures, curated word lists, and various rules for how to fit words together.

Here’s a small sample of my current sentence structures for titles and for truths.

  // Diagram titles
  [
    ["gerp", " ", "noun", " - ", "nouns"],
    ["nouns", " and their ", "adj", " ", "nouns"],
    ["gerp", " ", "nouns"],
    ["noun", " ", "verbsp", " ", "nouns"],
    ["intro-0", " ", "verbp", " ", "noun"],
  ];
  // "Truths"
  [
    ["The purpose of ", "noun", " is to ", "verb"],
    ["nouns", " begin when ", "nouns", " end"],
    ["You must ", "verbp", " ", "noun"],
    ["You should ", "verbp", " ", "noun"],
    ["noun", " is the key to ", "gerp", " ", "nouns"]
  ];
 

When generating a title, the system randomly chooses a structure and the words that fit into it. For example, these structures could lead to these outputs.

nouns of adj nouns

noun as noun: nouns

Word lists

I have created lists of:

  • Adjectives - abstract, liminal, timeless

  • Verbs - think, change, manifest

  • Nouns - time, dream, information

Side note: For the majority of my life I have had to recite from Massive Attack’s Teardrop - “Love, love is a verb, love is a doing word” to remember which ones verbs are but, since doing this project, I think I’ve finally dialled the information in.

I’ve carefully chosen the words in my lists to be the “right” kind of word for the effects I’m going for. I’ve been browsing through wikipedia articles and academic papers for ideas, as well as copying down words that come up here and there and strike me as suitable.

In the sentence structures above, you’ll also notice some other things like “gerp” and “verbp”. These are different grammatical versions of the verbs and nouns in my word lists (adjectives are always the same). There’s also “intro-0” which is a phrase, I’ll get to that later. Let’s look at how nouns and verbs are altered for different contexts.

 

Nouns

Here’s a small sample of entries in my noun list.

  // 0 - no plural
  // 1 - can be pluralised with s
  [
    ["tone", 1], 
    ["wonder", 1]
    ["fire", 1], 
    ["cognition", 0], 
    ["weather", 0, "the"], 
    ["hierarchy", "hierarchies", "a"],
    ["compass", "compasses", "a"]
  ]

The first position in the array is the singular form of the word. The second position in the array contains information about how to pluralise it.

  • 0: Some words are not included in plural, e.g. we would hardly ever refer to cognitions or weathers.

  • 1: Most words can be pluralised simply by adding an ‘s’, e.g. tone ➡️ tones.

  • String: Some words are spelled differently in plural, so a string can be provided to handle this case. e.g. hierarchy ➡️ hierarchies

 

The third (optional) position in the array allows me to define articles (e.g. a, an, the) for the singular version of the noun.

Some words don’t need an article - usually when they can be interpreted as a concept, or general idea of that thing. But many words feel more like they are referring to a specific item or an instance of a thing, so they need an article.

Some words don’t work in plural

Some words need an article.

 

When the code runs, it goes through the list of nouns and creates two new lists, one of singular nouns and one of plural nouns, using the specified rules. Then the sentence structures can call for either ‘noun’ (a singular noun) or ‘nouns’ (a plural noun).

 

When the sentence structure puts an adjective ahead of a noun, the adjective must be put after the article. i.e. we say ‘a curious cat’ not, ‘curious a cat’.

This creates an additional difficulty, because we now need to use ‘a’ or ‘an’ based on the sound at the start of the adjective instead of the noun. (TIL this is called allomorphy!)

For example, if we’re describing ‘a fire’ as ‘enigmatic’, we need to change the article to ‘an’ accommodate the ‘e’ in ‘enigmatic’ - we say ‘an enigmatic fire’ not ‘a enigmatic fire’. To handle this, the sentence generator looks at whether the adjective starts with a vowel and adjusts the article accordingly. There are also a few exceptions coded in specifically, for example ‘universal’ which starts with a vowel but is pronounced with a y sound and therefore would go with ‘a’ not ‘an’. Thanks, English.

 

Verbs

Verbs have a few more versions to handle. Here’s a small sample of entries in my verb list.

  // 1 - can be made gerund with ing
  // 2 - can be made gerund with -e and ing
  // --
  // 1 - can be made past tense with ed
  // 2 - can be made past tense with d
  [
    ["manifest", 1, 1],
    ["move", 2, 2, [2, 11, 12]],
    ["think", 1, "thought", [6]], 
    ["flow", 1, 0, [2, 11, 17]
  ]
 

The first item in each entry contains the verb in base form, e.g. ‘manifest

The second position contains information about how to turn it into a gerund:

  • 1: Just add ‘ing’, e.g. manifest ➡️ manifesting

  • 2: Remove the ‘e’ at the end and then add ‘ing’, e.g. move ➡️ moving

The third position contains information about how to make the verb past tense:

  • 1: Add ‘ed’, e.g. manifest ➡️ manifested

  • 2: Add ‘d’, e.g. move ➡️ moved

  • 3: String to define an irregular verb, e.g. think ➡️ thought

That’s all we need for some verbs, like manifest. But for others, like flow, it doesn’t quite work.

 

Some verbs are usually paired with a preposition (e.g. through, towards, about). Alongside the list of verbs, I have a list of prepositions, which will fix those awkward sentences. Here’s a sample of them.

  [
    "",
    "with", 
    "into", 
    "in",
    "to",
    "for",
    "about"
  ]
 

The optional fourth position in the verb array points to entries in the preposition array, indicating which ones that verb can be paired with. Here are some examples once the prepositions are paired with flow and move.

 

From the list of verbs, the system creates 5 different lists:

  • “verb” - base form of verb - manifest, move.

  • “verbsp” - verbs with preposition for singular nouns - manifests, moves towards

  • “verbp” - verbs with preposition for plural nouns - manifest, move towards

  • “gerp” - gerund with preposition - manifesting, moving towards

  • “pastp” - past tense with preposition - manifested, moved towards

 

A question of Sense

Some verbs, like think or learn present a deeper question. There is nothing grammatically wrong with the following sentences but… do they make sense?

A moment can flow into something for sure, but can it think about something?

Well, it’s kind of a judgement call. I definitely could add additional information to my word lists to ensure that certain verbs can only be paired with “appropriate” nouns. But I think something would be lost. Technically no, gravity does not learn about regret. But isn’t the idea kind of beautiful?

In general, there is perhaps a meaning-nonsense continuum that sentences can be placed along.

 

Phrases

In addition to the word lists, I also have lists of phrases which include:

  • Intros - Thoughts on, A system of, The role of

  • Questions - Is it possible that, are we to infer that, what if

  • Happenings - Patterns suggest that, we’re coming to realise that, it’s been suggested

  • Occasions - Sometimes, in some cases, almost always

  • Connections - is a pathway to, is a sign of, is a component of

These are used in specific contexts in the sentence structures. For example, Intros are specifically to be used in diagram titles while Questions were created for the notes written at the sides of diagrams. Connections are used between two nouns.

Examples of connections, occasionals, happenings and intros.

 

Semantic similarity

I experimented with semantic similarity for labels on diagrams - using words that are related to the title. I won’t go into detail about the process here, but I used a Python library called gensim and a model called glove-wiki-gigaword-100 to analyse my word lists. For each word, I generated a list of the most related other words.

Here’s an excerpt of the results:

{word: 'time', similar: ['start', 'beginning', 'chance', 'life', 'moment', 'thought', 'doing', 'experience', 'mind', 'future', 'stage', 'idea', 'hope', 'attention', 'action', 'matter', 'effect', 'thinking', 'problem', 'process', 'middle', 'goal', 'system', 'reality', 'dream']},
{word: 'cognition', similar: ['consciousness', 'psychology', 'perception', 'reasoning', 'emotion', 'creativity', 'computation', 'phenomena', 'semiotics', 'behaviour', 'learning', 'imagination', 'processes', 'simulation', 'metaphysics', 'theory', 'vibration', 'logic', 'cortex', 'cues', 'theories', 'morality', 'understanding', 'nature', 'knowledge']},
{word: 'tone', similar: ['contrast', 'emotion', 'pattern', 'gesture', 'mind', 'image', 'moment', 'narrative', 'language', 'clarity', 'perception', 'matter', 'perspective', 'effect', 'feeling', 'letter', 'balance', 'understanding', 'harmonies', 'attention', 'idea', 'action', 'imagery', 'thinking', 'meaning']},
{word: 'space', similar: ['energy', 'time', 'dimension', 'system', 'dimensions', 'environment', 'life', 'land', 'experience', 'laboratory', 'experiment', 'gravity', 'reality', 'future', 'idea', 'nature', 'box', 'vision', 'mind', 'existence', 'problem', 'image', 'moment', 'simulation', 'element']},
{word: 'motion', similar: ['action', 'effect', 'process', 'gravity', 'stage', 'reasoning', 'system', 'image', 'matter', 'idea', 'time', 'mind', 'space', 'human', 'narrative', 'reality', 'tone', 'sequence', 'letter', 'processes', 'theory', 'contrast', 'vision', 'moment', 'experiment']},

As words are chosen for the diagram title, a list of related words is generated and labels are chosen from that list.

Here’s an example showing a diagram with unrelated labels and then with related labels.

Unrelated, random labels

Semantically related labels

 

I was excited about this when I first got it working but I am not sure if I will use it in the final version of the diagrams because I think often it’s more interesting if the words and ideas are a bit scattered. To some degree, I feel like all the words are “related” because they are all in the category of “words I thought would work in this project”, and that might be enough.

However, it could be worth experimenting more with semantic similarity within sentences or paragraphs in the future.

 

A conduit for truth

In addition to the titles and notes on my diagrams, I’ve been using this system to generate “truths”. In April, I created the first series of “56 Truths”. I plotted them with my coded handwriting, using gold ink on small black cards which were placed into gold envelopes and stamped with their number. I handed the majority of them out at the Venice Biennale/Bright Moments weekend (I have about 8 left!)

 

To generate these “truths” I used an adapted list of sentence structures and I created a system for joining sentences together using connectors like ‘and’, ‘-’, ‘because’ and ‘when’, to create longer sentences.

I have since created a new, more bespoke set of sentence structures for these kinds of outputs and I look forward to releasing more “truths” into the world 😉

 

Handwritten artworks

I’ve also been using this system to generate content for my handwriting outputs. I wrote about these in more detail here.

Here are a couple of examples, drawn by my Axidraw plotter.

Some of these artworks are now available in my shop - with more being added regularly.

 

A journey of meaning

I mentioned earlier the idea of a meaning-nonsense continuum on which these sentences could be placed. This metamodernist oscillation between sincerity and irony is at the heart of this system (and of my generative diagrams).

I simultaneously hold two quite contradictory feelings towards them. Firstly that obviously they are nonsense. It’s just an algorithm, they’re made up, almost a joke. Obviously, obviously it’s meaningless. But, on the other hand - they do mean something. As is often the case, even when no specific meaning is intended, it is possible to find or infer a meaning.

Let’s take the first sentence, “The beginning is essential for consciousness”. Nonsense. Gibberish almost. But actually, what if the beginning is essential for consciousness? What’s meant by “the beginning”? The big bang? Is it saying there is some element of the first microseconds after the start of existence that is the key to understanding consciousness? Or perhaps it means the moment of conception?

If you don’t enjoy reading and contemplating these sentences like this, we are simply very different people.

A third, quieter feeling - if the universe was to communicate some message, who’s to say it would not choose this as a conduit? Perhaps I can take a leaf from Hilma Af Klint, who received instructions for her work in séances, and trust the meaning is intrinsic.

 

Work in progress

This system is an ongoing work in progress. Here are some things I have on my nebulous To Do List:

Add weighting between common and uncommon words.
If too many ‘fancy’ words are used, we stray a bit further into word-salad than I’d like. Words like thixotropic are fun to scatter around but (as in most writing) understandable words are usually more impactful.

Add possessives
In some contexts it would be great to talk about “your memory” instead of “a memory” or “our fears” instead of “fears”.

Develop the system for labels
Currently diagram labels use the noun list, but I plan to create a specific wordlist for them and/or to create short sentence structures for labels.

More, more, more
I’m really enjoying these outputs already but, like many generative systems, there are almost infinite ways in which I could expand and improve upon it. I’m continuing to add more sentence structures and more rules for increasingly complex outputs and to create opportunities to uncover deeper meanings.

 

😍 Enjoyed this article? I’d love it if you could give a boost on Twitter, thanks!

🎨 Have a look at my shop to see currently available outputs (more being added regularly!)

✨ And don’t forget to sign up for my weekly newsletter, filled with updates.

Previous
Previous

Chaos in the medium: watercolour plotting

Next
Next

Coding my Handwriting