A simple version of the Viterbi algorithm was implemented with recursive SQL.
The python code condains identical values leading to identical deterministic results. It is only for debugging purposes. The SQL code runs in PostgreSQL 14. The mysql implementation did not work, hence postgreSQL. I got some implementation ideas from "Probabilistic Declarative Information Extraction" by Wang et. al, which offers a thorough explanation.
code will be commented in the near future.