grammatical-error-correctio.../helpers/get-sentences.sh
2022-06-20 11:10:21 +02:00

16 lines
390 B
Bash

#!/bin/bash
input_file="$1"
method="$2"
extract_text() {
if [[ "$method" == "from-tex" ]]
then
detex "$input_file" | egrep '\S' | grep -v 'unsrt' | perl -pne 's/^\s+| +$//g'
else
bash helpers/pdf-to-plain-text.sh "$input_file" | perl helpers/strip-references.pl | perl -pne 'chomp $_; $_.=" "'
fi
}
extract_text | python3 -m syntok.segmenter | egrep '\S'