Finding software names with an online thesaurus

Updated on .

Naming software is hard – one of the hardest problems in computer science. I enjoy finding the perfect name for a concept, tool, or library I’m working on; enough that it’s almost further validation of the work. Beyond accurately reflecting what something does, a good name is unique. It stands out among the crowd of similar names and doesn’t cause confusion. In some languages, such as C, the name might need to show up in every function of an interface, so it should be short. I keep a list of Effective names in software to collect examples of good names I’ve found.

Traditional online dictionaries seem to have a limited selection of synonyms, so they weren’t very useful for naming. Recently, I found the Big Huge Thesaurus, a thesaurus API with reasonable rate limits and good synonyms. I never know which context I’ll want a synonym in, so I decided to add it to the globally-accessible LaunchBar utility I’m using instead of Spotlight. Here’s the custom LaunchBar action I use to list Big Huge Thesaurus’s synonyms of a given word:

const apiKey = '12345' // Need to request this from Big Huge Thesaurus

function run(argument) {
  if (argument == undefined) {
    LaunchBar.alert('No argument was passed to the action');
  } else {
    const word = encodeURIComponent(argument)
    const url = `https://words.bighugelabs.com/api/2/${apiKey}/${word}/json`
    const response = HTTP.getJSON(url)
    return Object.entries(response.data).flatMap(([partOfSpeech, info]) => {
      return info.syn.map(s => {
        return { title: s, subtitle: partOfSpeech, }
      })
    })
  }
}

It needs a valid API key from Big Huge Thesaurus to identify the requests. I typically invoke this using LaunchBar’s instant send feature, which makes the selected text available for input into an action. Once the text in LaunchBar’s window, I press tab and then start typing the name of the action.

Shortly after I integrated Big Huge Thesaurus into my workflow, I came across a unique kind of thesaurus in Datamuse and its lexical search API. The API is extremely flexible, with options to find words associated with each other based on sounds-like, spelled-like, and even related words like part-of, common adjectives, and frequent followers. Their website explains all of the possibilities. But the relationship I’m most interested for synonyms is “means-like”. I came up with the following LaunchBar action for interacting with Datamuse:

function run(argument) {
  if (argument == undefined) {
    LaunchBar.alert('No argument was passed to the action')
  } else {
    const firstSpace = argument.indexOf(' ')
    const action = firstSpace == -1 ? 'ml' : argument.substr(0, firstSpace)
    const query = firstSpace == -1 ? argument : argument.substr(firstSpace + 1)
    const q = encodeURIComponent(query)
    const url = `https://api.datamuse.com/words?${action}=${q}`
    const response = HTTP.getJSON(url)
    return response.data.map(w => { return { title: w.word } })
  }
}

It’s a bit more complex than the action for Big Huge Thesaurus, but it lets the first word of a multi-word query act as the query parameter. If the means-like ml parameter isn’t working, I can try another one like rel_gen (find the words that the input is a more general version of) to see if it comes up with anything interesting.