MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / extract_rating

Function extract_rating

core/recursive.py:166–181  ·  view source on GitHub ↗

Extract a numeric X/10 quality rating from critique text. Matches patterns like "Quality: 8/10", "7/10", "9 / 10". Returns None if no rating found.

(critique: str)

Source from the content-addressed store, hash-verified

164# ── Quality gate helpers ──────────────────────────────────────────────────────
165
166def extract_rating(critique: str) -> Optional[float]:
167 """
168 Extract a numeric X/10 quality rating from critique text.
169
170 Matches patterns like "Quality: 8/10", "7/10", "9 / 10".
171 Returns None if no rating found.
172 """
173 # "8/10", "8 / 10", "8.5/10"
174 m = re.search(r'(\d+(?:\.\d+)?)\s*/\s*10', critique)
175 if m:
176 return float(m.group(1))
177 # "8 out of 10"
178 m = re.search(r'(\d+(?:\.\d+)?)\s+out\s+of\s+10', critique, re.IGNORECASE)
179 if m:
180 return float(m.group(1))
181 return None
182
183
184def extract_doc_needs(critique: str) -> Optional[str]:

Callers 2

passes_quality_checkFunction · 0.85
recursive_inferFunction · 0.85

Calls 1

searchMethod · 0.45

Tested by

no test coverage detected