def METHOD_NAME(logits, input_data, label_names):
    batch_preds = logits.argmax(axis=-1).tolist()
    value = []
    for batch, preds in enumerate(batch_preds):
        start = -1
        label_name = ""
        items = []
        for i, pred in enumerate(preds):
            if (label_names[pred] == "O" or "B-" in label_names[pred]) and start >= 0:
                entity = input_data[batch][start : i - 1]
                if isinstance(entity, list):
                    entity = "".join(entity)
                items.append(
                    {
                        "slot": label_name,
                        "entity": entity,
                        "pos": [start, i - 2],
                    }
                )
                start = -1
            if "B-" in label_names[pred]:
                start = i - 1
                label_name = label_names[pred][2:]
        value.append(items)
    out_dict = {"value": value}
    return out_dict