Add try/catch around ngram array to dict