def boundary_check(string, start_idx, end_idx):
    """
    Check that given character indexes into given string
    align with token boundaries.

    """
    start_clause = (
        (start_idx == 0) or
        string[start_idx-1] in (" ", ",")
    )
    end_clause = (
        (end_idx == len(string)) or
        string[end_idx] in (" ", ",", ".")
    )

    return (start_clause and end_clause)