MCPcopy Create free account
hub / github.com/crisxuan/bestJavaer / measure

Function measure

scripts/check_article_quality.py:159–175  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

157
158
159def measure(text: str) -> Metrics:
160 clean = strip_markdown(text)
161 paragraphs = [
162 paragraph
163 for paragraph in re.split(r"\n\s*\n+", clean)
164 if meaningful_chars(paragraph) >= MIN_PARAGRAPH_CHARS
165 ]
166 sentences = [
167 sentence
168 for sentence in re.split(r"[。!?!?;;\n]+", clean)
169 if meaningful_chars(sentence) >= 8
170 ]
171 return Metrics(
172 chars=meaningful_chars(clean),
173 paragraphs=len(paragraphs),
174 sentences=len(sentences),
175 )
176
177
178def line_number(text: str, offset: int) -> int:

Callers 1

check_filesFunction · 0.85

Calls 3

strip_markdownFunction · 0.85
meaningful_charsFunction · 0.85
MetricsClass · 0.85

Tested by

no test coverage detected