code: public void debugLattice(OutputStream outputStream, String text) throws IOException {
          ViterbiLattice lattice = viterbiBuilder.build(text);
  
          outputStream.write(viterbiFormatter.format(lattice).getBytes(StandardCharsets.UTF_8));
          outputStream.flush();
      }
docs: Writes the Viterbi lattice for the provided text to an output stream
  <p>
  The output is written in <a href="https://en.wikipedia.org/wiki/DOT_(graph_description_language)">DOT</a> format.
  <p>
  This method is not thread safe
  
  @param outputStream  output stream to write to
  @param text  text to create lattice for
  @throws IOException if an error occurs when writing the lattice