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

[FR] Split paragraph into sentences #78

Closed
VerAn1015 opened this issue Feb 8, 2024 · 6 comments
Closed

[FR] Split paragraph into sentences #78

VerAn1015 opened this issue Feb 8, 2024 · 6 comments
Labels
use case: custom replace Command "Custom Replacement"

Comments

@VerAn1015
Copy link

Currently, we can merge broken paragraph in selection. There should also be an opposite of it wherein we break the paragraph into sentences. I believe this would be useful as well when copying and pasting information from pdfs and instead of it being a block of text, the sentences in the paragraph are broken up into its own line.

@Benature
Copy link
Owner

Benature commented Feb 8, 2024

That's true. But what criteria can I rely on to determine the appropriate places for paragraph breaks?

@VerAn1015
Copy link
Author

Perhaps adopting an approach similar to Semantic Line Breaker plugin? But instead of it also breaking compound sentences separated by a comma, it would only break paragraphs into sentences that are in "full stop" indicated by a period.

@Benature Benature added enhancement New feature or request need more info Further information is requested labels Feb 11, 2024
@Benature
Copy link
Owner

Perhaps adopting an approach similar to Semantic Line Breaker plugin? But instead of it also breaking compound sentences separated by a comma, it would only break paragraphs into sentences that are in "full stop" indicated by a period.

So your expectation is adding a line break between each sentence?
The symbols indicated full sentences would be ., ! or ?.

For example, if the input is

Currently, we can merge broken paragraph in selection. There should also be an opposite of it wherein we break the paragraph into sentences. I believe this would be useful as well when copying and pasting information from pdfs and instead of it being a block of text, the sentences in the paragraph are broken up into its own line.

Your expected result would be:

Currently, we can merge broken paragraph in selection. 
There should also be an opposite of it wherein we break the paragraph into sentences. 
I believe this would be useful as well when copying and pasting information from pdfs and instead of it being a block of text, the sentences in the paragraph are broken up into its own line.

Please tell me if I understand you correctly.

@VerAn1015
Copy link
Author

That is correct. For reference, this is the online tool I currently use for such functionality. It would be great if the plugin does it within Obsidian. Thanks!

@Benature
Copy link
Owner

Benature commented Mar 15, 2024

To boost the process of solving issues, I've developed a feature for custom replacement (#77). Here is the solution for your issue with the custom replacement:
image

Here are the contents of the screenshot above

Split paragraph into sentences
([\.\!\?]\s+)
$1\n

(note that the plugin version should be the latest, i.e. v2.7.1)

@Benature Benature added example and removed enhancement New feature or request need more info Further information is requested labels Mar 15, 2024
@VerAn1015
Copy link
Author

Just tested and it's perfect! Thank you!

@Benature Benature added this to the Custom Replacement milestone Mar 18, 2024
@Benature Benature added use case: custom replace Command "Custom Replacement" and removed example labels Mar 18, 2024
@Benature Benature removed this from the Custom Replacement milestone Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
use case: custom replace Command "Custom Replacement"
Projects
None yet
Development

No branches or pull requests

2 participants