MCPcopy Create free account
hub / github.com/ipython/ipython / sentencize

Function sentencize

docs/autogen_shortcuts.py:14–22  ·  view source on GitHub ↗

Extract first sentence

(s)

Source from the content-addressed store, hash-verified

12
13
14def sentencize(s):
15 """Extract first sentence
16 """
17 s = s.replace('\n', ' ').strip().split('.')
18 s = s[0] if len(s) else s
19 try:
20 return " ".join(s.split())
21 except AttributeError:
22 return s
23
24
25def most_common(lst, n=3):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected