docs: private void repairBrokenLatticeBefore(ViterbiLattice lattice, int index) {
          ViterbiNode[][] nodeStartIndices = lattice.getStartIndexArr();
  
          for (int startIndex = index; startIndex > 0; startIndex--) {
              if (nodeStartIndices[startIndex] != null) {
                  ViterbiNode glueBase = findGlueNodeCandidate(index, nodeStartIndices[startIndex], startIndex);
                  if (glueBase != null) {
                      int length = index + 1 - startIndex;
                      String surface = glueBase.getSurface().substring(0, length);
                      ViterbiNode glueNode = createGlueNode(startIndex, glueBase, surface);
                      lattice.addNode(glueNode, startIndex, startIndex + glueNode.getSurface().length());
                      return;
                  }
              }
          }
      }