MCPcopy Create free account
hub / github.com/AMAP-ML/Thinking-with-Map / parse_tsv

Function parse_tsv

demo/qwen_agent/tools/simple_doc_parser.py:184–199  ·  view source on GitHub ↗
(file_path: str, extract_image: bool = False)

Source from the content-addressed store, hash-verified

182
183
184def parse_tsv(file_path: str, extract_image: bool = False) -> List[dict]:
185 if extract_image:
186 raise ValueError('Currently, extracting images is not supported!')
187
188 import pandas as pd
189 md_tables = []
190 try:
191 df = pd.read_csv(file_path, sep='\t', encoding_errors='replace', on_bad_lines='skip')
192 except Exception as ex:
193 # Directly converted from Excel
194 logger.warning(ex)
195 return parse_excel(file_path, extract_image)
196 md_table = df_to_md(df)
197 md_tables.append(md_table) # There is only one table available
198
199 return [{'page_num': i + 1, 'content': [{'table': md_tables[i]}]} for i in range(len(md_tables))]
200
201
202def parse_html_bs(path: str, extract_image: bool = False):

Callers 1

callMethod · 0.85

Calls 2

parse_excelFunction · 0.85
df_to_mdFunction · 0.85

Tested by

no test coverage detected