From 827a5c928a3bf223066b641e3db0da41f05d66e0 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 10 Jul 2020 00:21:51 +0300 Subject: track sentences used in vimwiki --- bin/sentences | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/sentences (limited to 'bin/sentences') diff --git a/bin/sentences b/bin/sentences new file mode 100755 index 0000000..a02d061 --- /dev/null +++ b/bin/sentences @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +use strict; +my $pont=qr{[.!?]+}; ## pontuation +my $abrev=qr{\b(?:Pr|Dr|Mr|[A-Z])\.}; ## abreviations + +$/=""; + +while(<>){ chomp; ## for each paragraph, + + s/\h*\n\h*/ /g; ## remove \n + s/($pont)\h+(\S)/$1\n$2/g; ## pontuation+space + s/($abrev)\n/$1 /g; ## undo \n after abreviations + + print "$_\n\n"; +} -- cgit v1.2.3-70-g09d2