#34; % (k, v))


def calc_pr(y_i, x, y, b):
    idx = np.argwhere((y == y_i) == b)
    ct = x[idx[:, 0]].sum(0) + 1
    tot = ((y == y_i) == b).sum() + 1
    return ct / tot


def calc_r(y_i, x, y):
    return np.log(calc_pr(y_i, x, y, True) / calc_pr(y_i, x, y, False))


def _text_model(
    name,
    train_data,
    preproc=None,
    multilabel=None,
    classification=True,
    metrics=None,
    verbose=1,
):
    &#34;&#34;&#34;
    ```
    Build and return a text classification or text regression model.