-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added infowars transcripts for enhanced brainrot. added some parsing …
…of them.
- Loading branch information
Persephone Karnstein
authored and
Persephone Karnstein
committed
Jun 18, 2023
1 parent
0a345ca
commit b8c43de
Showing
6 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "infowars"] | ||
path = infowars | ||
url = https://github.com/Fudge/infowars.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
keras | ||
tensorflow | ||
protobuf==3.20.* | ||
sentencepiece | ||
deepmultilingualpunctuation | ||
alive-process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from deepmultilingualpunctuation import PunctuationModel | ||
from alive_progress import alive_bar | ||
import os,re,glob | ||
|
||
model = PunctuationModel() | ||
|
||
def clean_text(): | ||
path = os.getcwd() | ||
files = glob.glob(path + '/../infowars/*.txt') | ||
data = "" | ||
timestamp = re.compile(r'^\s*\[\d{1,2}(:\d{2})?:\d{2}\.\d{3} --> \d{1,2}(:\d{2})?:\d{2}\.\d{3}\]\s+') | ||
with alive_bar(len(files)) as bar: | ||
for f in files: | ||
result = "" | ||
for line in open(f).readlines(): | ||
result += " "+timestamp.sub('', line).strip() #remove the timestamps | ||
result = model.restore_punctuation(result) | ||
data += result | ||
bar() | ||
return data | ||
|
||
def save_to_corpus(text): | ||
path = os.getcwd() | ||
path += "/training-texts/alexjones.txt" | ||
if os.path.exists(path): | ||
os.remove(path) | ||
with open(path, "w") as f: | ||
f.write(text) | ||
|
||
data = clean_text() | ||
save_to_corpus(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters