Skip to content

Commit

Permalink
Removing useless lines + concat volumes into books (#11)
Browse files Browse the repository at this point in the history
* Removing useless lines + concat volumes into books
* Update bin/extract.sh
* Rm volumes within the "for" loop
  • Loading branch information
Maiann88 authored and fabi1cazenave committed Dec 26, 2024
1 parent 44e9733 commit d63e3fb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bin/extract.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/sh

mkdir -p txt
rm txt/*.txt

echo "Gutenberg..."
for corpus in corpus/gutenberg/*.txt
Expand All @@ -9,6 +10,17 @@ do
name=${file%.*}
echo "... $name"
cp $corpus txt/$name.txt
sed -i '/\[Illustration\]/d' txt/$name.txt
sed -i '1,/START OF THE PROJECT GUTENBERG/d' txt/$name.txt
sed -i '/END OF THE PROJECT GUTENBERG/,$d' txt/$name.txt
sed -i '/^End of Project Gutenberg/d' txt/$name.txt
sed -i '/\* \*/d' txt/$name.txt
done
for file in txt/*_[1-9].txt
do
volume=$(echo "$file" | sed 's/_[1-9].txt//g')
cat "$file" >> "$volume.txt"
rm "$file"
done

echo "Leipzig..."
Expand All @@ -20,3 +32,4 @@ do
tar -xzf $corpus "$name"/"$name"-sentences.txt -O \
| awk '!($1="")' > txt/"$name".txt
done

0 comments on commit d63e3fb

Please sign in to comment.