diff options
| author | Yigit Sever | 2020-07-10 00:21:51 +0300 |
|---|---|---|
| committer | Yigit Sever | 2020-07-10 00:21:51 +0300 |
| commit | 827a5c928a3bf223066b641e3db0da41f05d66e0 (patch) | |
| tree | 0aac06f010b5c0e3d27b49929ba88e9ca5c702b5 /bin/sentences | |
| parent | 27aefffc8a2d81786b2c402606bc59b53b163341 (diff) | |
| download | dotfiles-827a5c928a3bf223066b641e3db0da41f05d66e0.tar.gz dotfiles-827a5c928a3bf223066b641e3db0da41f05d66e0.tar.bz2 dotfiles-827a5c928a3bf223066b641e3db0da41f05d66e0.zip | |
track sentences used in vimwiki
Diffstat (limited to 'bin/sentences')
| -rwxr-xr-x | bin/sentences | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/sentences b/bin/sentences new file mode 100755 index 0000000..a02d061 --- /dev/null +++ b/bin/sentences | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | my $pont=qr{[.!?]+}; ## pontuation | ||
| 5 | my $abrev=qr{\b(?:Pr|Dr|Mr|[A-Z])\.}; ## abreviations | ||
| 6 | |||
| 7 | $/=""; | ||
| 8 | |||
| 9 | while(<>){ chomp; ## for each paragraph, | ||
| 10 | |||
| 11 | s/\h*\n\h*/ /g; ## remove \n | ||
| 12 | s/($pont)\h+(\S)/$1\n$2/g; ## pontuation+space | ||
| 13 | s/($abrev)\n/$1 /g; ## undo \n after abreviations | ||
| 14 | |||
| 15 | print "$_\n\n"; | ||
| 16 | } | ||
