MCPcopy Create free account
hub / github.com/nlweb-ai/NLWeb / clean_org_name

Function clean_org_name

AskAgent/python/data_loading/process_rss_by_org.py:29–47  ·  view source on GitHub ↗

Clean organization name for use as filename

(org_name)

Source from the content-addressed store, hash-verified

27 return False
28
29def clean_org_name(org_name):
30 """Clean organization name for use as filename"""
31 # Remove 'From ' prefix
32 if org_name.startswith('From '):
33 org_name = org_name[5:]
34
35 # Replace problematic characters
36 org_name = org_name.replace('/', '_')
37 org_name = org_name.replace('\\', '_')
38 org_name = org_name.replace(':', '_')
39 org_name = org_name.replace('*', '_')
40 org_name = org_name.replace('?', '_')
41 org_name = org_name.replace('"', '_')
42 org_name = org_name.replace('<', '_')
43 org_name = org_name.replace('>', '_')
44 org_name = org_name.replace('|', '_')
45 org_name = org_name.strip()
46
47 return org_name
48
49def clean_json_string(obj):
50 """Remove newlines from JSON string"""

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected