Extract first sentence
(s)
| 95 | |
| 96 | |
| 97 | def 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 | |
| 109 | class _DummyTerminal: |
no test coverage detected
searching dependent graphs…