MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / normalize_fields

Function normalize_fields

worked/example/raw/validator.py:39–49  ·  view source on GitHub ↗

Clean up text fields using the processor.

(doc: dict)

Source from the content-addressed store, hash-verified

37
38
39def normalize_fields(doc: dict) -> dict:
40 """Clean up text fields using the processor."""
41 if "title" in doc:
42 doc["title"] = normalize_text(doc["title"])
43 if len(doc["title"]) > MAX_TITLE_LENGTH:
44 doc["title"] = doc["title"][:MAX_TITLE_LENGTH]
45 if "paragraphs" in doc:
46 doc["paragraphs"] = [normalize_text(p) for p in doc["paragraphs"]]
47 if "sections" in doc:
48 doc["sections"] = [normalize_text(s) for s in doc["sections"]]
49 return doc
50
51
52def validate_batch(docs: list) -> tuple:

Callers 1

validate_documentFunction · 0.85

Calls 1

normalize_textFunction · 0.90

Tested by

no test coverage detected