Compute the context with respect to a center word in a sentence.

    Takes an numpy array of sentences boundaries.

def _get_context(center_idx, sentence_boundaries, window_size,
                 random_window_size, seed):
    """Compute the context with respect to a center word in a sentence.

    Takes an numpy array of sentences boundaries.

    """
    random.seed(seed + center_idx)

    sentence_index = np.searchsorted(sentence_boundaries, center_idx)
    sentence_start, sentence_end = _get_sentence_start_end(
        sentence_boundaries, sentence_index)

    if random_window_size:
        window_size = random.randint(1, window_size)
    start_idx = max(sentence_start, center_idx - window_size)
    end_idx = min(sentence_end, center_idx + window_size + 1)

    if start_idx != center_idx and center_idx + 1 != end_idx:
        context = np.concatenate((np.arange(start_idx, center_idx),
                                  np.arange(center_idx + 1, end_idx)))
    elif start_idx != center_idx:
        context = np.arange(start_idx, center_idx)
    elif center_idx + 1 != end_idx:
        context = np.arange(center_idx + 1, end_idx)
    else:
        context = None

    return context