Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

one sentence per line: option to allow other sentence separators (e.g. : or ;) #57

Open
tdegeus opened this issue Mar 14, 2023 · 0 comments

Comments

@tdegeus
Copy link
Owner

tdegeus commented Mar 14, 2023

texplain/texplain/__init__.py

Lines 1270 to 1285 in dae4e21

def _detail_one_sentence_per_line(text: str) -> str:
"""
Split text into sentences.
:param text: Text.
:return: Formatted text.
TODO: optional split characters such as ``;`` and ``:``
"""
text = re.split(r"(?<=[\.\!\?])\s+", text)
for i in range(len(text)):
text[i] = re.sub("(\n[\\ \t]*)([\\w\\$\\(\\[\\`])", r" \2", text[i])
return "\n".join(text)

@tdegeus tdegeus changed the title one sentence per line: allow other sentence separators (e.g. : or ;) one sentence per line: option to allow other sentence separators (e.g. : or ;) Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant