<commit_before>from typing import List

from mahjong.constants import CHUN, EAST, FIVE_RED_MAN, FIVE_RED_PIN, FIVE_RED_SOU, TERMINAL_INDICES


def is_aka_dora(tile_136: int, aka_enabled: bool) -> bool:
    """
    Check if tile is aka dora
    """
    if not aka_enabled:
        return False

    if tile_136 in [FIVE_RED_MAN, FIVE_RED_PIN, FIVE_RED_SOU]:
        return True

    return False


def plus_dora(tile_136: int, dora_indicators_136: List[int], add_aka_dora: bool = False) -> int:
    """
    Calculate the number of dora for the tile
    """
    tile_index = tile_136 // 4
    dora_count = 0

    if add_aka_dora and is_aka_dora(tile_136, aka_enabled=True):
        dora_count += 1

    for dora in dora_indicators_136:
        dora //= 4

        # sou, pin, man
        if tile_index < EAST:
            # with indicator 9, dora will be 1
            if dora == 8:
                dora = -1
            elif dora == 17:
                dora = 8
            elif dora == 26:
                dora = 17

            if tile_index == dora + 1:
                dora_count += 1
        else:
            if dora < EAST:
                continue

            dora -= 9 * 3
            tile_index_temp = tile_index - 9 * 3

            # dora indicator is north
            if dora == 3:
                dora = -1

            # dora indicator is hatsu
            if dora == 6:
                dora = 3

            if tile_index_temp == dora + 1:
                dora_count += 1

    return dora_count


def is_chi(item):
    """
    :param item: array of tile 34 indices
    :return: boolean
    """
    if len(item) != 3:
        return False

    return item[0] == item[1] - 1 == item[2] - 2


def is_pon(item):
    """
    :param item: array of tile 34 indices
    :return: boolean
    """
    if len(item) != 3:
        return False

    return item[0] == item[1] == item[2]


def is_pair(item):
    """
    :param item: array of tile 34 indices
    :return: boolean
    """
    return len(item) == 2


def is_man(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return tile <= 8


def is_pin(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return 8 < tile <= 17


def is_sou(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return 17 < tile <= 26


def is_honor(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return tile >= 27


def is_terminal(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return tile in TERMINAL_INDICES


def is_dora_indicator_for_terminal(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return tile == 7 or tile == 8 or tile == 16 or tile == 17 or tile == 25 or tile == 26


def contains_terminals(hand_set):
    """
    :param hand_set: array of 34 tiles
    :return: boolean
    """
    return any([x in TERMINAL_INDICES for x in hand_set])<commit_msg>Add is_sangenpai method<commit_after>from typing import List

from mahjong.constants import CHUN, EAST, FIVE_RED_MAN, FIVE_RED_PIN, FIVE_RED_SOU, TERMINAL_INDICES


def is_aka_dora(tile_136: int, aka_enabled: bool) -> bool:
    """
    Check if tile is aka dora
    """
    if not aka_enabled:
        return False

    if tile_136 in [FIVE_RED_MAN, FIVE_RED_PIN, FIVE_RED_SOU]:
        return True

    return False


def plus_dora(tile_136: int, dora_indicators_136: List[int], add_aka_dora: bool = False) -> int:
    """
    Calculate the number of dora for the tile
    """
    tile_index = tile_136 // 4
    dora_count = 0

    if add_aka_dora and is_aka_dora(tile_136, aka_enabled=True):
        dora_count += 1

    for dora in dora_indicators_136:
        dora //= 4

        # sou, pin, man
        if tile_index < EAST:
            # with indicator 9, dora will be 1
            if dora == 8:
                dora = -1
            elif dora == 17:
                dora = 8
            elif dora == 26:
                dora = 17

            if tile_index == dora + 1:
                dora_count += 1
        else:
            if dora < EAST:
                continue

            dora -= 9 * 3
            tile_index_temp = tile_index - 9 * 3

            # dora indicator is north
            if dora == 3:
                dora = -1

            # dora indicator is hatsu
            if dora == 6:
                dora = 3

            if tile_index_temp == dora + 1:
                dora_count += 1

    return dora_count


def is_chi(item):
    """
    :param item: array of tile 34 indices
    :return: boolean
    """
    if len(item) != 3:
        return False

    return item[0] == item[1] - 1 == item[2] - 2


def is_pon(item):
    """
    :param item: array of tile 34 indices
    :return: boolean
    """
    if len(item) != 3:
        return False

    return item[0] == item[1] == item[2]


def is_pair(item):
    """
    :param item: array of tile 34 indices
    :return: boolean
    """
    return len(item) == 2


def is_man(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return tile <= 8


def is_pin(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return 8 < tile <= 17


def is_sou(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return 17 < tile <= 26


def is_honor(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return tile >= 27


def is_sangenpai(tile_34: int) -> bool:
    return tile_34 >= 31


def is_terminal(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return tile in TERMINAL_INDICES


def is_dora_indicator_for_terminal(tile):
    """
    :param tile: 34 tile format
    :return: boolean
    """
    return tile == 7 or tile == 8 or tile == 16 or tile == 17 or tile == 25 or tile == 26


def contains_terminals(hand_set):
    """
    :param hand_set: array of 34 tiles
    :return: boolean
    """
    return any([x in TERMINAL_INDICES for x in hand_set])
{'fraction_non_alphanumeric': 0.10289495450785774, 'fraction_numerical': 0.0337468982630273, 'mean_word_length': 1.823914058851004, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4578113', 'n_tokens_mistral': 2234, 'n_tokens_neox': 1976, 'n_words': 630}