code: def post_process_seq(
      seq, bos_idx, eos_idx, output_bos=False, output_eos=False
  ):
      """
      Post-process the decoded sequence.
      """
      eos_pos = len(seq) - 1
      for i, idx in enumerate(seq):
          if idx == eos_idx:
              eos_pos = i
              break
      seq = [
          int(idx)
          for idx in seq[: eos_pos + 1]
          if (output_bos or idx != bos_idx)
          and (output_eos or idx != eos_idx)
      ]
      return seq
  
file_path: PaddleHub/modules/text/machine_translation/transformer/zh-en/utils.py
imports: import codecs
  import logging
  import re
  from typing import List
  import jieba
  from sacremoses import MosesDetokenizer
  from subword_nmt.apply_bpe import BPE
label_desc: Use image node_id 1 for calling a global function with example usage: post_process_seq(seq, bos_idx, eos_idx, output_bos, output_eos) and returns: seq