We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Bug] 数据集预处理中，对于含","的特殊文本未特殊处理
### Prerequisite

- [X] I have searched [Issues](https://github.com/open-mmlab/mmocr/issues) and [Discussions](https://github.com/open-mmlab/mmocr/discussions) but cannot get the expected help.
- [X] The bug has not been fixed in the [latest version (0.x)](https://github.com/open-mmlab/mmocr) or [latest version (1.x)](https://github.com/open-mmlab/mmocr/tree/dev-1.x).

### Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

### Branch

1.x branch https://github.com/open-mmlab/mmocr/tree/dev-1.x

### Environment

本次bug和环境无关
torch                   1.7.0
torchvision             0.8.1
mmcv                    2.0.0rc3
mmcv-full               1.7.0
mmdet                   3.0.0rc0
mmengine                0.1.0
mmocr                   1.0.0rc3 


### Reproduces the problem - code sample

相关代码在mmocr/datasets/preparers/parsers/icdar_txt_parser.py

### Reproduces the problem - command or script

python tools/dataset_converters/prepare_dataset.py icdar2015 --task textspotting

### Reproduces the problem - error message

no error message，检查发现部分图片预处理后的文本gt不对

### Additional information

1. 使用mmocr 1.x版本进行预处理icdar2015数据集为统一格式的json文件
2. 发现对文本处理时，未处理含分隔符的情况，如原始数据集的100,000文本，在统一格式中为100，即分隔符将文本分开后仅取了第一个文本
3. 具体例子如mmocr/data/icdar2015/textspotting_train.json中，在图片data/icdar2015/textdet_imgs/train/img_39.jpg的gt中，原始数据集文本标注为402,85,460,86,457,106,399,105,100,000，其中402,85,460,86,457,106,399,105为polygon标注，100,000为文本标注。但是预处理后的ocr数据集中，文本标注为100。
（因为在区分polygon标注和text标注时，通过分隔符","来区分，导致text文本被截断）


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mmocr/datasets/preparers/parsers/base.py`
Content:
```
1 # Copyright (c) OpenMMLab. All rights reserved.
2 from abc import abstractmethod
3 from functools import partial
4 from typing import Dict, List, Optional, Tuple, Union
5 
6 from mmengine import track_parallel_progress
7 
8 
9 class BaseParser:
10     """Base class for parsing annotations.
11 
12     Args:
13         data_root (str, optional): Path to the data root. Defaults to None.
14         nproc (int, optional): Number of processes. Defaults to 1.
15     """
16 
17     def __init__(self,
18                  data_root: Optional[str] = None,
19                  nproc: int = 1) -> None:
20         self.data_root = data_root
21         self.nproc = nproc
22 
23     def __call__(self, files: List[Tuple], split: str) -> List:
24         """Parse annotations.
25 
26         Args:
27             files (List[Tuple]): A list of a tuple of
28                 (image_path, annotation_path).
29             split (str): The split of the dataset.
30 
31         Returns:
32             List: A list of a tuple of (image_path, instances)
33         """
34         samples = self.parse_files(files, split)
35         return samples
36 
37     def parse_files(self, files: List[Tuple], split: str) -> List[Tuple]:
38         """Convert annotations to MMOCR format.
39 
40         Args:
41             files (Tuple): A list of tuple of path to image and annotation.
42 
43         Returns:
44             List[Tuple]: A list of a tuple of (image_path, instances)
45         """
46         func = partial(self.parse_file, split=split)
47         samples = track_parallel_progress(func, files, nproc=self.nproc)
48         return samples
49 
50     @abstractmethod
51     def parse_file(self, file: Tuple, split: str) -> Tuple:
52         """Convert annotation for a single image.
53 
54         Args:
55             file (Tuple): A tuple of path to image and annotation
56             split (str): Current split.
57 
58         Returns:
59             Tuple: A tuple of (img_path, instance). Instance is a list of dict
60             containing parsed annotations, which should contain the
61             following keys:
62             - 'poly' or 'box' (textdet or textspotting)
63             - 'text' (textspotting or textrecog)
64             - 'ignore' (all task)
65 
66         Examples:
67         An example of returned values:
68         >>> ('imgs/train/xxx.jpg',
69         >>> dict(
70         >>>    poly=[[[0, 1], [1, 1], [1, 0], [0, 0]]],
71         >>>    text='hello',
72         >>>    ignore=False)
73         >>> )
74         """
75         raise NotImplementedError
76 
77     def loader(self,
78                file_path: str,
79                separator: str = ',',
80                format: str = 'x1,y1,x2,y2,x3,y3,x4,y4,trans',
81                encoding='utf-8') -> Union[Dict, str]:
82         """A basic loader designed for .txt format annotation.
83 
84         Args:
85             file_path (str): Path to the txt file.
86             separator (str, optional): Separator of data. Defaults to ','.
87             format (str, optional): Annotation format.
88                 Defaults to 'x1,y1,x2,y2,x3,y3,x4,y4,trans'.
89             encoding (str, optional): Encoding format. Defaults to 'utf-8'.
90 
91         Yields:
92             Iterator[Union[Dict, str]]: Original text line or a dict containing
93             the information of the text line.
94         """
95         keys = format.split(separator)
96         with open(file_path, 'r', encoding=encoding) as f:
97             for line in f.readlines():
98                 line = line.strip()
99                 if line:
100                     yield dict(zip(keys, line.split(separator)))
101
```
--- 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()

```

diff --git a/mmocr/datasets/preparers/parsers/base.py b/mmocr/datasets/preparers/parsers/base.py
--- a/mmocr/datasets/preparers/parsers/base.py
+++ b/mmocr/datasets/preparers/parsers/base.py
@@ -79,7 +79,8 @@
                separator: str = ',',
                format: str = 'x1,y1,x2,y2,x3,y3,x4,y4,trans',
                encoding='utf-8') -> Union[Dict, str]:
-        """A basic loader designed for .txt format annotation.
+        """A basic loader designed for .txt format annotation. It greedily
+        extracts information separated by separators.
 
         Args:
             file_path (str): Path to the txt file.
@@ -96,5 +97,8 @@
         with open(file_path, 'r', encoding=encoding) as f:
             for line in f.readlines():
                 line = line.strip()
+                values = line.split(separator)
+                values = values[:len(keys) -
+                                1] + [separator.join(values[len(keys) - 1:])]
                 if line:
-                    yield dict(zip(keys, line.split(separator)))
+                    yield dict(zip(keys, values))

{"golden_diff": "diff --git a/mmocr/datasets/preparers/parsers/base.py b/mmocr/datasets/preparers/parsers/base.py\n--- a/mmocr/datasets/preparers/parsers/base.py\n+++ b/mmocr/datasets/preparers/parsers/base.py\n@@ -79,7 +79,8 @@\n                separator: str = ',',\n                format: str = 'x1,y1,x2,y2,x3,y3,x4,y4,trans',\n                encoding='utf-8') -> Union[Dict, str]:\n-        \"\"\"A basic loader designed for .txt format annotation.\n+        \"\"\"A basic loader designed for .txt format annotation. It greedily\n+        extracts information separated by separators.\n \n         Args:\n             file_path (str): Path to the txt file.\n@@ -96,5 +97,8 @@\n         with open(file_path, 'r', encoding=encoding) as f:\n             for line in f.readlines():\n                 line = line.strip()\n+                values = line.split(separator)\n+                values = values[:len(keys) -\n+                                1] + [separator.join(values[len(keys) - 1:])]\n                 if line:\n-                    yield dict(zip(keys, line.split(separator)))\n+                    yield dict(zip(keys, values))\n", "issue": "[Bug] \u6570\u636e\u96c6\u9884\u5904\u7406\u4e2d\uff0c\u5bf9\u4e8e\u542b\",\"\u7684\u7279\u6b8a\u6587\u672c\u672a\u7279\u6b8a\u5904\u7406\n### Prerequisite\n\n- [X] I have searched [Issues](https://github.com/open-mmlab/mmocr/issues) and [Discussions](https://github.com/open-mmlab/mmocr/discussions) but cannot get the expected help.\n- [X] The bug has not been fixed in the [latest version (0.x)](https://github.com/open-mmlab/mmocr) or [latest version (1.x)](https://github.com/open-mmlab/mmocr/tree/dev-1.x).\n\n### Task\n\nI'm using the official example scripts/configs for the officially supported tasks/models/datasets.\n\n### Branch\n\n1.x branch https://github.com/open-mmlab/mmocr/tree/dev-1.x\n\n### Environment\n\n\u672c\u6b21bug\u548c\u73af\u5883\u65e0\u5173\r\ntorch                   1.7.0\r\ntorchvision             0.8.1\r\nmmcv                    2.0.0rc3\r\nmmcv-full               1.7.0\r\nmmdet                   3.0.0rc0\r\nmmengine                0.1.0\r\nmmocr                   1.0.0rc3 \r\n\n\n### Reproduces the problem - code sample\n\n\u76f8\u5173\u4ee3\u7801\u5728mmocr/datasets/preparers/parsers/icdar_txt_parser.py\n\n### Reproduces the problem - command or script\n\npython tools/dataset_converters/prepare_dataset.py icdar2015 --task textspotting\n\n### Reproduces the problem - error message\n\nno error message\uff0c\u68c0\u67e5\u53d1\u73b0\u90e8\u5206\u56fe\u7247\u9884\u5904\u7406\u540e\u7684\u6587\u672cgt\u4e0d\u5bf9\n\n### Additional information\n\n1. \u4f7f\u7528mmocr 1.x\u7248\u672c\u8fdb\u884c\u9884\u5904\u7406icdar2015\u6570\u636e\u96c6\u4e3a\u7edf\u4e00\u683c\u5f0f\u7684json\u6587\u4ef6\r\n2. \u53d1\u73b0\u5bf9\u6587\u672c\u5904\u7406\u65f6\uff0c\u672a\u5904\u7406\u542b\u5206\u9694\u7b26\u7684\u60c5\u51b5\uff0c\u5982\u539f\u59cb\u6570\u636e\u96c6\u7684100,000\u6587\u672c\uff0c\u5728\u7edf\u4e00\u683c\u5f0f\u4e2d\u4e3a100\uff0c\u5373\u5206\u9694\u7b26\u5c06\u6587\u672c\u5206\u5f00\u540e\u4ec5\u53d6\u4e86\u7b2c\u4e00\u4e2a\u6587\u672c\r\n3. \u5177\u4f53\u4f8b\u5b50\u5982mmocr/data/icdar2015/textspotting_train.json\u4e2d\uff0c\u5728\u56fe\u7247data/icdar2015/textdet_imgs/train/img_39.jpg\u7684gt\u4e2d\uff0c\u539f\u59cb\u6570\u636e\u96c6\u6587\u672c\u6807\u6ce8\u4e3a402,85,460,86,457,106,399,105,100,000\uff0c\u5176\u4e2d402,85,460,86,457,106,399,105\u4e3apolygon\u6807\u6ce8\uff0c100,000\u4e3a\u6587\u672c\u6807\u6ce8\u3002\u4f46\u662f\u9884\u5904\u7406\u540e\u7684ocr\u6570\u636e\u96c6\u4e2d\uff0c\u6587\u672c\u6807\u6ce8\u4e3a100\u3002\r\n\uff08\u56e0\u4e3a\u5728\u533a\u5206polygon\u6807\u6ce8\u548ctext\u6807\u6ce8\u65f6\uff0c\u901a\u8fc7\u5206\u9694\u7b26\",\"\u6765\u533a\u5206\uff0c\u5bfc\u81f4text\u6587\u672c\u88ab\u622a\u65ad\uff09\r\n\n", "before_files": [{"content": "# Copyright (c) OpenMMLab. All rights reserved.\nfrom abc import abstractmethod\nfrom functools import partial\nfrom typing import Dict, List, Optional, Tuple, Union\n\nfrom mmengine import track_parallel_progress\n\n\nclass BaseParser:\n    \"\"\"Base class for parsing annotations.\n\n    Args:\n        data_root (str, optional): Path to the data root. Defaults to None.\n        nproc (int, optional): Number of processes. Defaults to 1.\n    \"\"\"\n\n    def __init__(self,\n                 data_root: Optional[str] = None,\n                 nproc: int = 1) -> None:\n        self.data_root = data_root\n        self.nproc = nproc\n\n    def __call__(self, files: List[Tuple], split: str) -> List:\n        \"\"\"Parse annotations.\n\n        Args:\n            files (List[Tuple]): A list of a tuple of\n                (image_path, annotation_path).\n            split (str): The split of the dataset.\n\n        Returns:\n            List: A list of a tuple of (image_path, instances)\n        \"\"\"\n        samples = self.parse_files(files, split)\n        return samples\n\n    def parse_files(self, files: List[Tuple], split: str) -> List[Tuple]:\n        \"\"\"Convert annotations to MMOCR format.\n\n        Args:\n            files (Tuple): A list of tuple of path to image and annotation.\n\n        Returns:\n            List[Tuple]: A list of a tuple of (image_path, instances)\n        \"\"\"\n        func = partial(self.parse_file, split=split)\n        samples = track_parallel_progress(func, files, nproc=self.nproc)\n        return samples\n\n    @abstractmethod\n    def parse_file(self, file: Tuple, split: str) -> Tuple:\n        \"\"\"Convert annotation for a single image.\n\n        Args:\n            file (Tuple): A tuple of path to image and annotation\n            split (str): Current split.\n\n        Returns:\n            Tuple: A tuple of (img_path, instance). Instance is a list of dict\n            containing parsed annotations, which should contain the\n            following keys:\n            - 'poly' or 'box' (textdet or textspotting)\n            - 'text' (textspotting or textrecog)\n            - 'ignore' (all task)\n\n        Examples:\n        An example of returned values:\n        >>> ('imgs/train/xxx.jpg',\n        >>> dict(\n        >>>    poly=[[[0, 1], [1, 1], [1, 0], [0, 0]]],\n        >>>    text='hello',\n        >>>    ignore=False)\n        >>> )\n        \"\"\"\n        raise NotImplementedError\n\n    def loader(self,\n               file_path: str,\n               separator: str = ',',\n               format: str = 'x1,y1,x2,y2,x3,y3,x4,y4,trans',\n               encoding='utf-8') -> Union[Dict, str]:\n        \"\"\"A basic loader designed for .txt format annotation.\n\n        Args:\n            file_path (str): Path to the txt file.\n            separator (str, optional): Separator of data. Defaults to ','.\n            format (str, optional): Annotation format.\n                Defaults to 'x1,y1,x2,y2,x3,y3,x4,y4,trans'.\n            encoding (str, optional): Encoding format. Defaults to 'utf-8'.\n\n        Yields:\n            Iterator[Union[Dict, str]]: Original text line or a dict containing\n            the information of the text line.\n        \"\"\"\n        keys = format.split(separator)\n        with open(file_path, 'r', encoding=encoding) as f:\n            for line in f.readlines():\n                line = line.strip()\n                if line:\n                    yield dict(zip(keys, line.split(separator)))\n", "path": "mmocr/datasets/preparers/parsers/base.py"}], "after_files": [{"content": "# Copyright (c) OpenMMLab. All rights reserved.\nfrom abc import abstractmethod\nfrom functools import partial\nfrom typing import Dict, List, Optional, Tuple, Union\n\nfrom mmengine import track_parallel_progress\n\n\nclass BaseParser:\n    \"\"\"Base class for parsing annotations.\n\n    Args:\n        data_root (str, optional): Path to the data root. Defaults to None.\n        nproc (int, optional): Number of processes. Defaults to 1.\n    \"\"\"\n\n    def __init__(self,\n                 data_root: Optional[str] = None,\n                 nproc: int = 1) -> None:\n        self.data_root = data_root\n        self.nproc = nproc\n\n    def __call__(self, files: List[Tuple], split: str) -> List:\n        \"\"\"Parse annotations.\n\n        Args:\n            files (List[Tuple]): A list of a tuple of\n                (image_path, annotation_path).\n            split (str): The split of the dataset.\n\n        Returns:\n            List: A list of a tuple of (image_path, instances)\n        \"\"\"\n        samples = self.parse_files(files, split)\n        return samples\n\n    def parse_files(self, files: List[Tuple], split: str) -> List[Tuple]:\n        \"\"\"Convert annotations to MMOCR format.\n\n        Args:\n            files (Tuple): A list of tuple of path to image and annotation.\n\n        Returns:\n            List[Tuple]: A list of a tuple of (image_path, instances)\n        \"\"\"\n        func = partial(self.parse_file, split=split)\n        samples = track_parallel_progress(func, files, nproc=self.nproc)\n        return samples\n\n    @abstractmethod\n    def parse_file(self, file: Tuple, split: str) -> Tuple:\n        \"\"\"Convert annotation for a single image.\n\n        Args:\n            file (Tuple): A tuple of path to image and annotation\n            split (str): Current split.\n\n        Returns:\n            Tuple: A tuple of (img_path, instance). Instance is a list of dict\n            containing parsed annotations, which should contain the\n            following keys:\n            - 'poly' or 'box' (textdet or textspotting)\n            - 'text' (textspotting or textrecog)\n            - 'ignore' (all task)\n\n        Examples:\n        An example of returned values:\n        >>> ('imgs/train/xxx.jpg',\n        >>> dict(\n        >>>    poly=[[[0, 1], [1, 1], [1, 0], [0, 0]]],\n        >>>    text='hello',\n        >>>    ignore=False)\n        >>> )\n        \"\"\"\n        raise NotImplementedError\n\n    def loader(self,\n               file_path: str,\n               separator: str = ',',\n               format: str = 'x1,y1,x2,y2,x3,y3,x4,y4,trans',\n               encoding='utf-8') -> Union[Dict, str]:\n        \"\"\"A basic loader designed for .txt format annotation. It greedily\n        extracts information separated by separators.\n\n        Args:\n            file_path (str): Path to the txt file.\n            separator (str, optional): Separator of data. Defaults to ','.\n            format (str, optional): Annotation format.\n                Defaults to 'x1,y1,x2,y2,x3,y3,x4,y4,trans'.\n            encoding (str, optional): Encoding format. Defaults to 'utf-8'.\n\n        Yields:\n            Iterator[Union[Dict, str]]: Original text line or a dict containing\n            the information of the text line.\n        \"\"\"\n        keys = format.split(separator)\n        with open(file_path, 'r', encoding=encoding) as f:\n            for line in f.readlines():\n                line = line.strip()\n                values = line.split(separator)\n                values = values[:len(keys) -\n                                1] + [separator.join(values[len(keys) - 1:])]\n                if line:\n                    yield dict(zip(keys, values))\n", "path": "mmocr/datasets/preparers/parsers/base.py"}]}