def count_word(x, sep=None):
    """ Extract number of words in a string """
    try:
        return len(str(x).split(sep))
    except Exception as e:
        print(f"Exception raised:\n{e}")
        return 0