Skip to content

smc_record

string_for_serialization(ctx)

Serialize a token context as the escaped, pipe-joined record string.

Source code in genlm/control/sampler/smc_record.py
def string_for_serialization(ctx):
    """Serialize a token context as the escaped, pipe-joined record string."""
    return "|".join(escape(y) for y in ctx)