Code LFs
If your labeling logic can't be expressed by any of the LF builders, you can write a Python function in the in-platform notebook and convert it into a labeling function. Code LFs function identically to other LFs that are created in Snorkel Flow.
Here is an example code LF. Use @labeling_function() to define your LF, and sf.add_code_lf() to add the LF to the model node for your application.
import snorkelflow.client as sf
from snorkel.labeling.lf import labeling_function
@labeling_function()
def my_code_lf(x):
    if "drug" in x.body:
        return "SPAM"
    return "UNKNOWN"
# Save to a model node
sf.add_code_lf(node, my_code_lf)