code: 
  
  
  
  
  
  '''simple docstring'''
  
  from __future__ import annotations
  
  import os
  
  
  
  
  
  
  class      UpperCAmelCase			:
   __lowercase     	=       (
       """High card""",
       """One pair""",
       """Two pairs""",
       """Three of a kind""",
       """Straight""",
       """Flush""",
       """Full house""",
       """Four of a kind""",
       """Straight flush""",
       """Royal flush""",
   )
  
   __lowercase     	=       (
       """""",  # placeholder as tuples are zero-indexed
       """One""",
       """Two""",
       """Three""",
       """Four""",
       """Five""",
       """Six""",
       """Seven""",
       """Eight""",
       """Nine""",
       """Ten""",
       """Jack""",
       """Queen""",
       """King""",
       """Ace""",
   )
   def __init__(       self   :int		, lowercase_   :str							)->							None:
       if not isinstance(lowercase_		, lowercase_							):
           A__       =    F"Hand should be of type 'str': {hand!r}"
           raise TypeError(lowercase_							)
       # split removes duplicate whitespaces so no need of strip
       if len(hand.split(" "							)							) != 5:
           A__       =    F"Hand should contain only 5 cards: {hand!r}"
           raise ValueError(lowercase_							)
       A__       =    hand
       A__       =    0
       A__       =    0
       A__,			A__       =    self._internal_state()
       A__       =    self._get_hand_type()
       A__       =    self._card_values[0]
   @property
   def   UpperCAmelCase_							(       self   :str							)->							Tuple:
       return self._hand
   def   UpperCAmelCase_							(       self   :Tuple		, lowercase_   :PokerHand							)->							str:
       # Breaking the tie works on the following order of precedence:
       # 1. First pair (default 0)
       # 2. Second pair (default 0)
       # 3. Compare all cards in reverse order because they are sorted.
  
       # First pair and second pair will only be a non-zero value if the card
       # type is either from the following:
       # 21: Four of a kind
       # 20: Full house
       # 17: Three of a kind
       # 16: Two pairs
       # 15: One pair
       if self._hand_type > other._hand_type:
           return "Win"
       elif self._hand_type < other._hand_type:
           return "Loss"
       elif self._first_pair == other._first_pair:
           if self._second_pair == other._second_pair:
               return self._compare_cards(lowercase_							)
           else:
               return "Win" if self._second_pair > other._second_pair else "Loss"
       return "Win" if self._first_pair > other._first_pair else "Loss"
   def   UpperCAmelCase_							(       self   :Any							)->							str:
       A__       =    PokerHand._HAND_NAME[self._hand_type - 14]
       A__       =    PokerHand._CARD_NAME[self._high_card]
       A__       =    PokerHand._CARD_NAME[self._first_pair]
       A__       =    PokerHand._CARD_NAME[self._second_pair]
       if self._hand_type in [22, 19, 18]:
           return name + F", {high}-high"
       elif self._hand_type in [21, 17, 15]:
           return name + F", {paira}s"
       elif self._hand_type in [20, 16]:
           A__       =    "over" if self._hand_type == 20 else "and"
           return name + F", {paira}s {join} {paira}s"
       elif self._hand_type == 23:
           return name
       else:
           return name + F", {high}"
   def   UpperCAmelCase_							(       self   :Dict		, lowercase_   :PokerHand							)->							str:
       # Enumerate gives us the index as well as the element of a list
       for index, card_value in enumerate(self._card_values							):
           if card_value != other._card_values[index]:
               return "Win" if card_value > other._card_values[index] else "Loss"
       return "Tie"
   def   UpperCAmelCase_							(       self   :List[Any]							)->							int:
       # Number representing the type of hand internally:
       # 23: Royal flush
       # 22: Straight flush
       # 21: Four of a kind
       # 20: Full house
       # 19: Flush
       # 18: Straight
       # 17: Three of a kind
       # 16: Two pairs
       # 15: One pair
       # 14: High card
       if self._is_flush():
           if self._is_five_high_straight() or self._is_straight():
               return 23 if sum(self._card_values							) == 60 else 22
           return 19
       elif self._is_five_high_straight() or self._is_straight():
           return 18
       return 14 + self._is_same_kind()
   def   UpperCAmelCase_							(       self   :str							)->							bool:
       return len(self._card_suit							) == 1
   def   UpperCAmelCase_							(       self   :Optional[int]							)->							bool:
       # If a card is a five high straight (low ace) change the location of
       # ace from the start of the list to the end. Check whether the first
       # element is ace or not. (Don't want to change again)
       # Five high straight (low ace): AH 2H 3S 4C 5D
       # Why use sorted here? One call to this function will mutate the list to
       # [5, 4, 3, 2, 14] and so for subsequent calls (which will be rare) we
       # need to compare the sorted version.
       # Refer test_multiple_calls_five_high_straight in test_poker_hand.py
       if sorted(self._card_values							) == [2, 3, 4, 5, 14]:
           if self._card_values[0] == 14:
               # Remember, our list is sorted in reverse order
               A__       =    self._card_values.pop(0							)
               self._card_values.append(lowercase_							)
           return True
       return False
   def   UpperCAmelCase_							(       self   :Tuple							)->							bool:
       for i in range(4							):
           if self._card_values[i] - self._card_values[i + 1] != 1:
               return False
       return True
   def   UpperCAmelCase_							(       self   :int							)->							int:
       # Kind Values for internal use:
       # 7: Four of a kind
       # 6: Full house
       # 3: Three of a kind
       # 2: Two pairs
       # 1: One pair
       # 0: False
       A__       =    A__       =    A__       =    0
       for i in range(4							):
           # Compare two cards at a time, if they are same increase 'kind',
           # add the value of the card to val1, if it is repeating again we
           # will add 2 to 'kind' as there are now 3 cards with same value.
           # If we get card of different value than val1, we will do the same
           # thing with val2
           if self._card_values[i] == self._card_values[i + 1]:
               if not vala:
                   A__       =    self._card_values[i]
                   kind += 1
               elif vala == self._card_values[i]:
                   kind += 2
               elif not vala:
                   A__       =    self._card_values[i]
                   kind += 1
               elif vala == self._card_values[i]:
                   kind += 2
          # For consistency in hand type (look at note in _get_hand_type function)
       A__       =    kind + 2 if kind in [4, 5] else kind
       # first meaning first pair to compare in 'compare_with'
       A__       =    max(lowercase_		, lowercase_							)
       A__       =    min(lowercase_		, lowercase_							)
       # If it's full house (three count pair + two count pair), make sure
       # first pair is three count and if not then switch them both.
       if kind == 6 and self._card_values.count(lowercase_							) != 3:
           A__,			A__       =    second, first
       A__       =    first
       A__       =    second
       return kind
   def   UpperCAmelCase_							(       self   :Any							)->							tuple[list[int], set[str]]:
       # Internal representation of hand as a list of card values and
       # a set of card suit
       A__       =    {"T": "10", "J": "11", "Q": "12", "K": "13", "A": "14"}
       A__       =    self._hand.translate(str.maketrans(lowercase_							)							).split()
       A__       =    [int(card[:-1]							) for card in new_hand]
       A__       =    {card[-1] for card in new_hand}
       return sorted(lowercase_		, reverse=lowercase_							), card_suit
   def __repr__(       self   :Dict							)->							List[Any]:
       return F"{self.__class__}(\"{self._hand}\")"
   def __str__(       self   :Optional[int]							)->							int:
       return self._hand
   def __eq__(       self   :Any		, lowercase_   :Optional[int]							)->							Optional[Any]:
       if isinstance(lowercase_		, lowercase_							):
           return self.compare_with(lowercase_							) == "Tie"
       return NotImplemented
   def __lt__(       self   :Optional[int]		, lowercase_   :str							)->							List[Any]:
       if isinstance(lowercase_		, lowercase_							):
           return self.compare_with(lowercase_							) == "Loss"
       return NotImplemented
   def __le__(       self   :List[Any]		, lowercase_   :str							)->							Any:
       if isinstance(lowercase_		, lowercase_							):
           return self < other or self == other
       return NotImplemented
   def __gt__(       self   :Optional[Any]		, lowercase_   :Union[str, Any]							)->							List[Any]:
       if isinstance(lowercase_		, lowercase_							):
           return not self < other and self != other
       return NotImplemented
   def __ge__(       self   :Optional[int]		, lowercase_   :Union[str, Any]							)->							Any:
       if isinstance(lowercase_		, lowercase_							):
           return not self < other
       return NotImplemented
  
  
  
   def __hash__(       self   :Optional[int]							)->							int:
       return object.__hash__(self							)
  
  
  
  
  
  def 		UpperCamelCase       (							):
      # Solution for problem number 54 from Project Euler
      # Input from poker_hands.txt file
      A__       =    0
      A__       =    os.path.abspath(os.path.dirname(_lowerCamelCase ) )
      A__       =    os.path.join(_lowerCamelCase		, "poker_hands.txt" )
      with open(_lowerCamelCase ) as file_hand:
          for line in file_hand:
              A__       =    line[:14].strip()
              A__       =    line[15:].strip()
              A__,			A__       =    PokerHand(_lowerCamelCase ), PokerHand(_lowerCamelCase )
              A__       =    player.compare_with(_lowerCamelCase )
              if output == "Win":
                  answer += 1
      return answer
  
  
  if __name__ == "__main__":
    solution()
  
  
  
  
style_context: 
  
  
  
  
  
  '''simple docstring'''
  
  import sacrebleu as scb
  from packaging import version
  
  import datasets
  
  
  __lowerCAmelCase							:			Tuple				="\\n@inproceedings{post-2018-call,\n    title = \"A Call for Clarity in Reporting {BLEU} Scores\",\n    author = \"Post, Matt\",\n    booktitle = \"Proceedings of the Third Conference on Machine Translation: Research Papers\",\n    month = oct,\n    year = \"2018\",\n    address = \"Belgium, Brussels\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://www.aclweb.org/anthology/W18-6319\",\n    pages = \"186--191\",\n}\n"
  
  __lowerCAmelCase							:			Dict				="\\nSacreBLEU provides hassle-free computation of shareable, comparable, and reproducible BLEU scores.\nInspired by Rico Sennrich's `multi-bleu-detok.perl`, it produces the official WMT scores but works with plain text.\nIt also knows all the standard test sets and handles downloading, processing, and tokenization for you.\n\nSee the [README.md] file at https://github.com/mjpost/sacreBLEU for more information.\n"
  
  __lowerCAmelCase							:			Dict				="\nProduces BLEU scores along with its sufficient statistics\nfrom a source against one or more references.\n\nArgs:\n    predictions (`list` of `str`): list of translations to score. Each translation should be tokenized into a list of tokens.\n    references (`list` of `list` of `str`): A list of lists of references. The contents of the first sub-list are the references for the first prediction, the contents of the second sub-list are for the second prediction, etc. Note that there must be the same number of references for each prediction (i.e. all sub-lists must be of the same length).\n    smooth_method (`str`): The smoothing method to use, defaults to `'exp'`. Possible values are:\n        - `'none'`: no smoothing\n        - `'floor'`: increment zero counts\n        - `'add-k'`: increment num/denom by k for n>1\n        - `'exp'`: exponential decay\n    smooth_value (`float`): The smoothing value. Only valid when `smooth_method='floor'` (in which case `smooth_value` defaults to `0.1`) or `smooth_method='add-k'` (in which case `smooth_value` defaults to `1`).\n    tokenize (`str`): Tokenization method to use for BLEU. If not provided, defaults to `'zh'` for Chinese, `'ja-mecab'` for Japanese and `'13a'` (mteval) otherwise. Possible values are:\n        - `'none'`: No tokenization.\n        - `'zh'`: Chinese tokenization.\n        - `'13a'`: mimics the `mteval-v13a` script from Moses.\n        - `'intl'`: International tokenization, mimics the `mteval-v14` script from Moses\n        - `'char'`: Language-agnostic character-level tokenization.\n        - `'ja-mecab'`: Japanese tokenization. Uses the [MeCab tokenizer](https://pypi.org/project/mecab-python3).\n    lowercase (`bool`): If `True`, lowercases the input, enabling case-insensitivity. Defaults to `False`.\n    force (`bool`): If `True`, insists that your tokenized input is actually detokenized. Defaults to `False`.\n    use_effective_order (`bool`): If `True`, stops including n-gram orders for which precision is 0. This should be `True`, if sentence-level BLEU will be computed. Defaults to `False`.\n\nReturns:\n    'score': BLEU score,\n    'counts': Counts,\n    'totals': Totals,\n    'precisions': Precisions,\n    'bp': Brevity penalty,\n    'sys_len': predictions length,\n    'ref_len': reference length,\n\nExamples:\n\n    Example 1:\n        >>> predictions = [\"hello there general kenobi\", \"foo bar foobar\"]\n        >>> references = [[\"hello there general kenobi\", \"hello there !\"], [\"foo bar foobar\", \"foo bar foobar\"]]\n        >>> sacrebleu = datasets.load_metric(\"sacrebleu\")\n        >>> results = sacrebleu.compute(predictions=predictions, references=references)\n        >>> print(list(results.keys()))\n        ['score', 'counts', 'totals', 'precisions', 'bp', 'sys_len', 'ref_len']\n        >>> print(round(results[\"score\"], 1))\n        100.0\n\n    Example 2:\n        >>> predictions = [\"hello there general kenobi\",\n        ...                 \"on our way to ankh morpork\"]\n        >>> references = [[\"hello there general kenobi\", \"hello there !\"],\n        ...                 [\"goodbye ankh morpork\", \"ankh morpork\"]]\n        >>> sacrebleu = datasets.load_metric(\"sacrebleu\")\n        >>> results = sacrebleu.compute(predictions=predictions,\n        ...                             references=references)\n        >>> print(list(results.keys()))\n        ['score', 'counts', 'totals', 'precisions', 'bp', 'sys_len', 'ref_len']\n        >>> print(round(results[\"score\"], 1))\n        39.8\n"
  
  
  
  
  
  
  @datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION    , _KWARGS_DESCRIPTION       )
  class      UpperCAmelCase			( datasets.Metric       ):
   def   UpperCAmelCase_							(       self   :int							)->							Union[str, Any]:
       if version.parse(scb.__version__							) < version.parse("1.4.12"							):
           raise ImportWarning(
               "To use `sacrebleu`, the module `sacrebleu>=1.4.12` is required, and the current version of `sacrebleu` doesn't match this condition.\n"
               "You can install it with `pip install \"sacrebleu>=1.4.12\"`."							)
       return datasets.MetricInfo(
           description=_DESCRIPTION		, citation=_CITATION		, homepage="https://github.com/mjpost/sacreBLEU"		, inputs_description=_KWARGS_DESCRIPTION		, features=datasets.Features(
               {
                   "predictions": datasets.Value("string"		, id="sequence"							),
                   "references": datasets.Sequence(datasets.Value("string"		, id="sequence"							)		, id="references"							),
               }							)		, codebase_urls=["https://github.com/mjpost/sacreBLEU"]		, reference_urls=[
               "https://github.com/mjpost/sacreBLEU",
               "https://en.wikipedia.org/wiki/BLEU",
               "https://towardsdatascience.com/evaluating-text-output-in-nlp-bleu-at-your-own-risk-e8609665a213",
           ]		, )
  
  
  
   def   UpperCAmelCase_							(       self   :Tuple		, lowercase_   :Optional[int]		, lowercase_   :Optional[Any]		, lowercase_   :List[str]="exp"		, lowercase_   :str=None		, lowercase_   :Tuple=False		, lowercase_   :Any=False		, lowercase_   :Optional[Any]=None		, lowercase_   :Any=False		, )->							Tuple:
       A__       =    len(references[0]							)
       if any(len(lowercase_							) != references_per_prediction for refs in references							):
           raise ValueError("Sacrebleu requires the same number of references for each prediction"							)
       A__       =    [[refs[i] for refs in references] for i in range(lowercase_							)]
       A__       =    scb.corpus_bleu(
           lowercase_		, lowercase_		, smooth_method=lowercase_		, smooth_value=lowercase_		, force=lowercase_		, lowercase=lowercase_		, use_effective_order=lowercase_		, **({"tokenize": tokenize} if tokenize else {})		, )
       A__       =    {
           "score": output.score,
           "counts": output.counts,
           "totals": output.totals,
           "precisions": output.precisions,
           "bp": output.bp,
           "sys_len": output.sys_len,
           "ref_len": output.ref_len,
       }
       return output_dict
  
  
  
  