Creating Meaningful Nonsense: JavaScript Sentence Generation

BYMark Howell 1 years ago6 MINS READ
Creating Meaningful Nonsense: JavaScript Sentence Generation

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.
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.

  • Nouns of adjective nouns
  • Noun as noun: nouns

Image with Description

An early example of a generative diagram with meaningful nonsense titles.
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. 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.

Copy link Nouns

Here’s a small sample of entries in my noun list. 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. This creates an additional difficulty when we 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!)

Copy link Verbs

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

  • First item contains the verb in base form, e.g. ‘manifest’
  • Second position contains information about how to turn it into a gerund: 1: Just add ‘ing’, e.g. manifest ➡️ manifesting
  • The third position contains information about how to make the verb past tense: 1: Add ‘ed’, e.g. manifest ➡️ manifested
    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.
Edworking
All your work in one place
All-in-one platform for your team and your work. Register now for Free.
Get Started Now

Copy link 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? 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
    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.

Copy link Semantic Similarity

I experimented with semantic similarity for labels on diagrams - using words that are related to the title. I used a Python library called gensim and a model called glove-wiki-gigaword-100 to analyse my word lists.
Here’s an example showing a diagram with unrelated labels and then with related labels.

  • Unrelated, random labels
  • Semantically related labels

Copy link A Conduit for Truth

In addition to the titles and notes on my diagrams, I’ve been using this system to generate “truths”.

Copy link Handwritten Artworks

I’ve also been using this system to generate content for my handwriting outputs. Here are a couple of examples, drawn by my Axidraw plotter.
Edworking is the best and smartest decision for SMEs and startups to be more productive. Edworking is a FREE superapp of productivity that includes all you need for work powered by AI in the same superapp, connecting Task Management, Docs, Chat, Videocall, and File Management. Save money today by not paying for Slack, Trello, Dropbox, Zoom, and Notion.

Edworking
All your work in one place
All-in-one platform for your team and your work. Register now for Free.
Get Started Now

Copy link 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).

Copy link 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.
  • Add possessives in some contexts.
  • Develop the system for labels.

Copy link Remember these 3 key ideas for your startup:

  1. Innovation through Automation: Embrace task automation that can manage and generate meaningful data automatically. It saves time and enhances creativity.
  2. Semantic Similarity Utilization: Use semantic algorithms to create contextually relevant content, which can enhance your branding and communication strategies.
  3. Experimentation and Flexibility: Adopt a continuous improvement mindset. Innovate, test, and refine systems to uncover more profound applications and meanings.
  • For more details, see the original source.
  • Mark Howell

    About the Author: Mark Howell

    LinkedIn

    Mark Howell is a talented content writer for Edworking's blog, consistently producing high-quality articles on a daily basis. As a Sales Representative, he brings a unique perspective to his writing, providing valuable insights and actionable advice for readers in the education industry. With a keen eye for detail and a passion for sharing knowledge, Mark is an indispensable member of the Edworking team. His expertise in task management ensures that he is always on top of his assignments and meets strict deadlines. Furthermore, Mark's skills in project management enable him to collaborate effectively with colleagues, contributing to the team's overall success and growth. As a reliable and diligent professional, Mark Howell continues to elevate Edworking's blog and brand with his well-researched and engaging content.

    Startups

    Try Edworking Background

    A new way to work from anywhere, for everyone for Free!

    Get Started Now