xia_composer.parser.Parser
- class xia_composer.parser.Parser
Bases:
object
- __init__()
Methods
__init__
()build_output
(output_value, output_type, ...)Extract the related data from output text
extract_code
(code_type, output_text)extract_list
(output_text)extract_output
(title, full_text)Extract the related data from full output text
extract_python_encode
(output_format, output_text)parse_code
(code, code_path[, output_type, ...])Generate output string by using code
parse_detailed_type
(obj)parse_format
(value)parse_image_url
(output_text)parse_output
(output_text[, output_type, ...])Extract the related data from output text
strip_explanation
(output_text)Stripping the explanation part of output text
- classmethod build_output(output_value, output_type: str, output_format: str)
Extract the related data from output text
- Parameters
output_value (Any) – Any value of output
output_format (str) –
output_type (str) –
- Returns
Result if format is correct. None if format is not good
- classmethod extract_output(title: str, full_text: str)
Extract the related data from full output text
- Parameters
title – Title used to split output
full_text – Output of GPT Engine
- Returns
Result if format is correct. None if format is not good
- classmethod parse_code(code: str, code_path: str, output_type: Optional[str] = None, output_format: Optional[str] = None) str
Generate output string by using code
- Parameters
code – Code Text
code_path – Code Path
output_type – output_type
output_format – output_format
- Returns
Output text
- classmethod parse_output(output_text: str, output_type: Optional[str] = None, output_format: Optional[str] = None)
Extract the related data from output text
- Parameters
output_format (str) –
output_type (str) –
output_text – Result of task
- Returns
Result if format is correct. None if format is not good
- classmethod strip_explanation(output_text: str)
Stripping the explanation part of output text
- Parameters
output_text (str) – task output
- Returns
Essential part of task output