MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / parse_custom_string

Method parse_custom_string

get_ner.py:31–42  ·  view source on GitHub ↗
(self, input_str)

Source from the content-addressed store, hash-verified

29 self.yesterday = (datetime.date.today() + datetime.timedelta(days=-1)).strftime("%Y%m%d")
30
31 def parse_custom_string(self, input_str):
32 input_str = input_str.replace(' ', '').replace('\n', '').replace('"', '')
33 key_value_pattern = r"(\w+):\s*({.*?}|[^,{}]+)"
34 matches = re.findall(key_value_pattern, input_str)
35
36 result = {}
37 for key, value in matches:
38 if value.startswith("{"):
39 result[key] = self.parse_custom_string(value)
40 else:
41 result[key] = value
42 return result
43
44 def parse_json(self, input_str):
45 res = {}

Callers 1

parse_jsonMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected