function createWordIndex(exampleData) {
  /** @type {Object<string, Object<number, number>>} */
  const index = {};
  /** @type {Array<'shortdesc'|'title'|'tags'>} */
  const keys = ['shortdesc', 'title', 'tags'];
  exampleData.forEach((data, i) => {
    keys.forEach((key) => {
      let text = data[key] || '';
      if (Array.isArray(text)) {
        text = text.join(' ');
      }
      const words = text.toLowerCase().split(/\W+/);
      words.forEach((word) => {
        if (word) {
          let counts = index[word];
          if (!counts) {
            counts = {};
            index[word] = counts;
          }
          counts[i] = (counts[i] || 0) + 1;
        }
      });
    });
  });
  return index;
}
Create an inverted index of keywords from examples.  Property names are
lowercased words.  Property values are objects mapping example index to word
count.
@param {Array<{shortdesc: string, title: string, tags: Array<string>}>} exampleData Array of example data objects.
@return {Object<string, Object<number, number>>} Word index.