





import io
import json
import subprocess


UpperCAmelCase_       : Optional[int]							=    [
    ["""en""", """ru"""],
    ["""ru""", """en"""],
    ["""en""", """de"""],
    ["""de""", """en"""],
]

UpperCAmelCase_       : str							=    8






def 				_lowerCAmelCase			(	_a :       Tuple       , _a :       List[Any]      )						->      Any:
     lowerCAmelCase_       :							int			 =		{}
     for src, tgt in pairs:
          lowerCAmelCase_       :							Tuple			 =		F'{src}-{tgt}'
          lowerCAmelCase_       :							Any			 =		F'sacrebleu -t wmt19 -l {pair} --echo src'.split()
          lowerCAmelCase_       :							Union[str, Any]			 =		subprocess.run(_a       , stdout=subprocess.PIPE      ).stdout.decode("""utf-8"""      ).splitlines()
          lowerCAmelCase_       :							Optional[int]			 =		F'sacrebleu -t wmt19 -l {pair} --echo ref'.split()
          lowerCAmelCase_       :							List[str]			 =		subprocess.run(_a       , stdout=subprocess.PIPE      ).stdout.decode("""utf-8"""      ).splitlines()
          lowerCAmelCase_       :							Tuple			 =		{"""src""": src_lines[:n_objs], """tgt""": tgt_lines[:n_objs]}
     return text


UpperCAmelCase_       : List[Any]							=    get_all_data(pairs, n_objs)
UpperCAmelCase_       : Tuple							=    """./fsmt_val_data.json"""
with io.open(filename, """w""", encoding="""utf-8""") as f:
      UpperCAmelCase_       : Tuple							=    json.dump(text, f, indent=2, ensure_ascii=False)







def 				_lowerCAmelCase			(	_a :       str      )						->      int:
     lowerCAmelCase_       :							List[str]			 =		53_81
     for x in s:
          lowerCAmelCase_       :							Dict			 =		((hash_value << 5) + hash_value) + ord(_a      )
     return hash_value & 0XFFFFFFFF
