K
Docs
πŸ”€

Define a Word

info.defineThe AlmanacLook-ups

Looks a word up in the English Wiktionary and brings back its first meaning, what kind of word it is, an example sentence when there is one, and up to three numbered meanings ready to send.

When to use this
  • β†’{{word.definitions}} lists up to three meanings, numbered

On the canvas

This is what Define a Word looks like when you place it on your flow. Each field below is something you configure in the inspector panel.

πŸ”€
Define a Word
info.define
Look-ups
wordrequired
e.g. {{input.options.word}}
asrequired
word
found
missing
error

Config fields

FieldTypeReqWhat it does
word
e.g. {{input.options.word}}
textyesWhich word πŸ”€
as
word
textyesSave it as ✨

Sparks this piece adds

After this piece runs, these values are available as sparks in every node downstream.

{{word.word}}stringThe word
{{word.type}}stringnoun, verb, adjective…
{{word.definition}}stringIts first meaning
{{word.example}}stringAn example sentence (when there is one)
{{word.definitions}}stringUp to three meanings, numbered
{{word.count}}numberHow many meanings it has
{{word.url}}stringLink to it on Wiktionary
{{word.query}}stringWhat was looked up
{{word.error}}stringWhy it couldn't be looked up

Output ports

foundThe meaning is in your spark β€” {{word.definition}}
missingNothing matched β€” {{…query}} says what they asked for
errorCouldn't ask right now (busy or down) β€” {{…error}} says why
πŸ“

In TypeScript, this would be…

Not something you need to write β€” just a look at what Kitcord does for you.

TypeScript
const res = await fetch(
  `https://en.wiktionary.org/api/rest_v1/page/definition/${encodeURIComponent(word)}`,
);
if (res.status === 404) return; // Missing βˆ…
const [first] = (await res.json()).en; // English meanings
const meaning = first.definitions[0].definition.replace(/<[^>]+>/g, ""); // {{word.definition}}