Text this: Fast factorisation of probabilistic potentials and its application to approximate inference in Bayesian networks