MCPcopy Index your code
hub / github.com/ipython/ipython / sentencize

Function sentencize

docs/autogen_shortcuts.py:97–106  ·  view source on GitHub ↗

Extract first sentence

(s)

Source from the content-addressed store, hash-verified

95
96
97def sentencize(s) -> str:
98 """Extract first sentence"""
99 s = re.split(r"\.\W", s.replace("\n", " ").strip())
100 s = s[0] if len(s) else ""
101 if not s.endswith("."):
102 s += "."
103 try:
104 return " ".join(s.split())
105 except AttributeError:
106 return s
107
108
109class _DummyTerminal:

Callers 1

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…