Custom Content Moderation#

Custom content moderation enables you to define any words or phrases to moderate content in real-time and low-latency or asynchronously. The defined words and phrases will be masked except for the first letter of each word (e.g. “I h*** w**** g***.”). The original words can still be retrieved using the Word.orig_text field.


In the example below, we defined custom words and phrases to be moderated when transcribing a short file.

from soniox.transcribe_file import transcribe_file_short
from soniox.speech_service import SpeechClient

# Do not forget to set your API key in the SONIOX_API_KEY environment variable.
def main():
    with SpeechClient() as client:
        result = transcribe_file_short(
            content_moderation_phrases=["two years", "homesick"],
        print("Words: " + " ".join(w.text for w in result.words))

if __name__ == "__main__":




He was t** y**** out from the east and had not yet forgotten to be h******* at times