def to_w2v_format(token):
    """Return a given entity token in the format as it would appear in the w2v
    model: I.e. lowercase and entities in the format "[<QID>]"

    Arguments:
    token - A string.

    >>> to_w2v_format("[Q123:test]")
    '[q123]'
    >>> to_w2v_format("[fictional character|Q123:test]")
    '[q123]'
    """
    token = token.lower()
    token = token.strip("[]")
    if "|" in token:
        token = token.split("|")[1]
    if ":" in token:
        # token is an entity. Return in w2v format: "[<qid>]"
        return "[" + token.split(":", 1)[0] + "]"
    else:
        return "[" + token + "]"