Marcus Felix (Marcus Vinicius Felix Oliveira) — Product Engineer

class StochasticParrot {
  data = {};
  train(text) {
    const words = text.toLowerCase().split(/\s+/);
    words.forEach((w, i) => {
      if (words[i + 1]) (this.data[w] ??= []).push(words[i + 1]);
    });
  }
  complete(str, len = 5) {
    let res = str.toLowerCase().split(/\s+/);
    while (len--) {
      const next = this.data[res.at(-1)];
      if (!next) break;
      res.push(next[Math.floor(Math.random() * next.length)]);
    }
    return res.join(" ");
  }
}

Hi, I’m Marcus Felix. I develop digital products, from design to implementation. More important than building is to know what to build. I write about my learnings and share my projects here.

0 people
liked this website
1.

Work

Just Dice GmbH

2.

Side project

Deploid

3.

Listening

Steely Dan

4.

Learning

German B1

6.

Side project

Barney

8.

Gaming

Valheim

7.

Reading

Simulacra and Simulation

Articles