prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Fix some problems in the ctc beam search decoder
  - [x] Make character's index in FST starting from one, otherwise wrong decoding results would be produced especially when space is the first character in the vocabulary;
  - [x] Add version check in the setup script;
  - [x] Remove unused code. 
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `decoders/swig/setup.py`
  Content:
  ```
  1 """Script to build and install decoder package."""
  2 from __future__ import absolute_import
  3 from __future__ import division
  4 from __future__ import print_function
  5 
  6 from setuptools import setup, Extension, distutils
  7 import glob
  8 import platform
  9 import os, sys
  10 import multiprocessing.pool
  11 import argparse
  12 
  13 parser = argparse.ArgumentParser(description=__doc__)
  14 parser.add_argument(
  15     "--num_processes",
  16     default=1,
  17     type=int,
  18     help="Number of cpu processes to build package. (default: %(default)d)")
  19 args = parser.parse_known_args()
  20 
  21 # reconstruct sys.argv to pass to setup below
  22 sys.argv = [sys.argv[0]] + args[1]
  23 
  24 
  25 # monkey-patch for parallel compilation
  26 # See: https://stackoverflow.com/a/13176803
  27 def parallelCCompile(self,
  28                      sources,
  29                      output_dir=None,
  30                      macros=None,
  31                      include_dirs=None,
  32                      debug=0,
  33                      extra_preargs=None,
  34                      extra_postargs=None,
  35                      depends=None):
  36     # those lines are copied from distutils.ccompiler.CCompiler directly
  37     macros, objects, extra_postargs, pp_opts, build = self._setup_compile(
  38         output_dir, macros, include_dirs, sources, depends, extra_postargs)
  39     cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
  40 
  41     # parallel code
  42     def _single_compile(obj):
  43         try:
  44             src, ext = build[obj]
  45         except KeyError:
  46             return
  47         self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  48 
  49     # convert to list, imap is evaluated on-demand
  50     thread_pool = multiprocessing.pool.ThreadPool(args[0].num_processes)
  51     list(thread_pool.imap(_single_compile, objects))
  52     return objects
  53 
  54 
  55 def compile_test(header, library):
  56     dummy_path = os.path.join(os.path.dirname(__file__), "dummy")
  57     command = "bash -c \"g++ -include " + header \
  58                 + " -l" + library + " -x c++ - <<<'int main() {}' -o " \
  59                 + dummy_path + " >/dev/null 2>/dev/null && rm " \
  60                 + dummy_path + " 2>/dev/null\""
  61     return os.system(command) == 0
  62 
  63 
  64 # hack compile to support parallel compiling
  65 distutils.ccompiler.CCompiler.compile = parallelCCompile
  66 
  67 FILES = glob.glob('kenlm/util/*.cc') \
  68         + glob.glob('kenlm/lm/*.cc') \
  69         + glob.glob('kenlm/util/double-conversion/*.cc')
  70 
  71 FILES += glob.glob('openfst-1.6.3/src/lib/*.cc')
  72 
  73 FILES = [
  74     fn for fn in FILES
  75     if not (fn.endswith('main.cc') or fn.endswith('test.cc') or fn.endswith(
  76         'unittest.cc'))
  77 ]
  78 
  79 LIBS = ['stdc++']
  80 if platform.system() != 'Darwin':
  81     LIBS.append('rt')
  82 
  83 ARGS = ['-O3', '-DNDEBUG', '-DKENLM_MAX_ORDER=6', '-std=c++11']
  84 
  85 if compile_test('zlib.h', 'z'):
  86     ARGS.append('-DHAVE_ZLIB')
  87     LIBS.append('z')
  88 
  89 if compile_test('bzlib.h', 'bz2'):
  90     ARGS.append('-DHAVE_BZLIB')
  91     LIBS.append('bz2')
  92 
  93 if compile_test('lzma.h', 'lzma'):
  94     ARGS.append('-DHAVE_XZLIB')
  95     LIBS.append('lzma')
  96 
  97 os.system('swig -python -c++ ./decoders.i')
  98 
  99 decoders_module = [
  100     Extension(
  101         name='_swig_decoders',
  102         sources=FILES + glob.glob('*.cxx') + glob.glob('*.cpp'),
  103         language='c++',
  104         include_dirs=[
  105             '.',
  106             'kenlm',
  107             'openfst-1.6.3/src/include',
  108             'ThreadPool',
  109         ],
  110         libraries=LIBS,
  111         extra_compile_args=ARGS)
  112 ]
  113 
  114 setup(
  115     name='swig_decoders',
  116     version='1.0',
  117     description="""CTC decoders""",
  118     ext_modules=decoders_module,
  119     py_modules=['swig_decoders'], )
  120
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/decoders/swig/setup.py b/decoders/swig/setup.py
  --- a/decoders/swig/setup.py
  +++ b/decoders/swig/setup.py
  @@ -113,7 +113,7 @@
   
   setup(
       name='swig_decoders',
  -    version='1.0',
  +    version='1.1',
       description="""CTC decoders""",
       ext_modules=decoders_module,
       py_modules=['swig_decoders'], )
  
verification_info: {"golden_diff": "diff --git a/decoders/swig/setup.py b/decoders/swig/setup.py\n--- a/decoders/swig/setup.py\n+++ b/decoders/swig/setup.py\n@@ -113,7 +113,7 @@\n \n setup(\n     name='swig_decoders',\n-    version='1.0',\n+    version='1.1',\n     description=\"\"\"CTC decoders\"\"\",\n     ext_modules=decoders_module,\n     py_modules=['swig_decoders'], )\n", "issue": "Fix some problems in the ctc beam search decoder\n- [x] Make character's index in FST starting from one, otherwise wrong decoding results would be produced especially when space is the first character in the vocabulary;\r\n- [x] Add version check in the setup script;\r\n- [x] Remove unused code. \r\n\n", "before_files": [{"content": "\"\"\"Script to build and install decoder package.\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom setuptools import setup, Extension, distutils\nimport glob\nimport platform\nimport os, sys\nimport multiprocessing.pool\nimport argparse\n\nparser = argparse.ArgumentParser(description=__doc__)\nparser.add_argument(\n    \"--num_processes\",\n    default=1,\n    type=int,\n    help=\"Number of cpu processes to build package. (default: %(default)d)\")\nargs = parser.parse_known_args()\n\n# reconstruct sys.argv to pass to setup below\nsys.argv = [sys.argv[0]] + args[1]\n\n\n# monkey-patch for parallel compilation\n# See: https://stackoverflow.com/a/13176803\ndef parallelCCompile(self,\n                     sources,\n                     output_dir=None,\n                     macros=None,\n                     include_dirs=None,\n                     debug=0,\n                     extra_preargs=None,\n                     extra_postargs=None,\n                     depends=None):\n    # those lines are copied from distutils.ccompiler.CCompiler directly\n    macros, objects, extra_postargs, pp_opts, build = self._setup_compile(\n        output_dir, macros, include_dirs, sources, depends, extra_postargs)\n    cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)\n\n    # parallel code\n    def _single_compile(obj):\n        try:\n            src, ext = build[obj]\n        except KeyError:\n            return\n        self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)\n\n    # convert to list, imap is evaluated on-demand\n    thread_pool = multiprocessing.pool.ThreadPool(args[0].num_processes)\n    list(thread_pool.imap(_single_compile, objects))\n    return objects\n\n\ndef compile_test(header, library):\n    dummy_path = os.path.join(os.path.dirname(__file__), \"dummy\")\n    command = \"bash -c \\\"g++ -include \" + header \\\n                + \" -l\" + library + \" -x c++ - <<<'int main() {}' -o \" \\\n                + dummy_path + \" >/dev/null 2>/dev/null && rm \" \\\n                + dummy_path + \" 2>/dev/null\\\"\"\n    return os.system(command) == 0\n\n\n# hack compile to support parallel compiling\ndistutils.ccompiler.CCompiler.compile = parallelCCompile\n\nFILES = glob.glob('kenlm/util/*.cc') \\\n        + glob.glob('kenlm/lm/*.cc') \\\n        + glob.glob('kenlm/util/double-conversion/*.cc')\n\nFILES += glob.glob('openfst-1.6.3/src/lib/*.cc')\n\nFILES = [\n    fn for fn in FILES\n    if not (fn.endswith('main.cc') or fn.endswith('test.cc') or fn.endswith(\n        'unittest.cc'))\n]\n\nLIBS = ['stdc++']\nif platform.system() != 'Darwin':\n    LIBS.append('rt')\n\nARGS = ['-O3', '-DNDEBUG', '-DKENLM_MAX_ORDER=6', '-std=c++11']\n\nif compile_test('zlib.h', 'z'):\n    ARGS.append('-DHAVE_ZLIB')\n    LIBS.append('z')\n\nif compile_test('bzlib.h', 'bz2'):\n    ARGS.append('-DHAVE_BZLIB')\n    LIBS.append('bz2')\n\nif compile_test('lzma.h', 'lzma'):\n    ARGS.append('-DHAVE_XZLIB')\n    LIBS.append('lzma')\n\nos.system('swig -python -c++ ./decoders.i')\n\ndecoders_module = [\n    Extension(\n        name='_swig_decoders',\n        sources=FILES + glob.glob('*.cxx') + glob.glob('*.cpp'),\n        language='c++',\n        include_dirs=[\n            '.',\n            'kenlm',\n            'openfst-1.6.3/src/include',\n            'ThreadPool',\n        ],\n        libraries=LIBS,\n        extra_compile_args=ARGS)\n]\n\nsetup(\n    name='swig_decoders',\n    version='1.0',\n    description=\"\"\"CTC decoders\"\"\",\n    ext_modules=decoders_module,\n    py_modules=['swig_decoders'], )\n", "path": "decoders/swig/setup.py"}], "after_files": [{"content": "\"\"\"Script to build and install decoder package.\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom setuptools import setup, Extension, distutils\nimport glob\nimport platform\nimport os, sys\nimport multiprocessing.pool\nimport argparse\n\nparser = argparse.ArgumentParser(description=__doc__)\nparser.add_argument(\n    \"--num_processes\",\n    default=1,\n    type=int,\n    help=\"Number of cpu processes to build package. (default: %(default)d)\")\nargs = parser.parse_known_args()\n\n# reconstruct sys.argv to pass to setup below\nsys.argv = [sys.argv[0]] + args[1]\n\n\n# monkey-patch for parallel compilation\n# See: https://stackoverflow.com/a/13176803\ndef parallelCCompile(self,\n                     sources,\n                     output_dir=None,\n                     macros=None,\n                     include_dirs=None,\n                     debug=0,\n                     extra_preargs=None,\n                     extra_postargs=None,\n                     depends=None):\n    # those lines are copied from distutils.ccompiler.CCompiler directly\n    macros, objects, extra_postargs, pp_opts, build = self._setup_compile(\n        output_dir, macros, include_dirs, sources, depends, extra_postargs)\n    cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)\n\n    # parallel code\n    def _single_compile(obj):\n        try:\n            src, ext = build[obj]\n        except KeyError:\n            return\n        self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)\n\n    # convert to list, imap is evaluated on-demand\n    thread_pool = multiprocessing.pool.ThreadPool(args[0].num_processes)\n    list(thread_pool.imap(_single_compile, objects))\n    return objects\n\n\ndef compile_test(header, library):\n    dummy_path = os.path.join(os.path.dirname(__file__), \"dummy\")\n    command = \"bash -c \\\"g++ -include \" + header \\\n                + \" -l\" + library + \" -x c++ - <<<'int main() {}' -o \" \\\n                + dummy_path + \" >/dev/null 2>/dev/null && rm \" \\\n                + dummy_path + \" 2>/dev/null\\\"\"\n    return os.system(command) == 0\n\n\n# hack compile to support parallel compiling\ndistutils.ccompiler.CCompiler.compile = parallelCCompile\n\nFILES = glob.glob('kenlm/util/*.cc') \\\n        + glob.glob('kenlm/lm/*.cc') \\\n        + glob.glob('kenlm/util/double-conversion/*.cc')\n\nFILES += glob.glob('openfst-1.6.3/src/lib/*.cc')\n\nFILES = [\n    fn for fn in FILES\n    if not (fn.endswith('main.cc') or fn.endswith('test.cc') or fn.endswith(\n        'unittest.cc'))\n]\n\nLIBS = ['stdc++']\nif platform.system() != 'Darwin':\n    LIBS.append('rt')\n\nARGS = ['-O3', '-DNDEBUG', '-DKENLM_MAX_ORDER=6', '-std=c++11']\n\nif compile_test('zlib.h', 'z'):\n    ARGS.append('-DHAVE_ZLIB')\n    LIBS.append('z')\n\nif compile_test('bzlib.h', 'bz2'):\n    ARGS.append('-DHAVE_BZLIB')\n    LIBS.append('bz2')\n\nif compile_test('lzma.h', 'lzma'):\n    ARGS.append('-DHAVE_XZLIB')\n    LIBS.append('lzma')\n\nos.system('swig -python -c++ ./decoders.i')\n\ndecoders_module = [\n    Extension(\n        name='_swig_decoders',\n        sources=FILES + glob.glob('*.cxx') + glob.glob('*.cpp'),\n        language='c++',\n        include_dirs=[\n            '.',\n            'kenlm',\n            'openfst-1.6.3/src/include',\n            'ThreadPool',\n        ],\n        libraries=LIBS,\n        extra_compile_args=ARGS)\n]\n\nsetup(\n    name='swig_decoders',\n    version='1.1',\n    description=\"\"\"CTC decoders\"\"\",\n    ext_modules=decoders_module,\n    py_modules=['swig_decoders'], )\n", "path": "decoders/swig/setup.py"}]}