-
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.
- Loading branch information
1 parent
099fd56
commit 8516718
Showing
3 changed files
with
32 additions
and
0 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,32 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Crocrodile NN Training files separation tool. | ||
Selects a given number of elements into a NN Training file. | ||
""" | ||
import os | ||
import random | ||
|
||
os.chdir("..") | ||
|
||
file = input("From file : ") | ||
number = int(input("Number of elements : ")) | ||
to = input("To file : ") | ||
|
||
print("Reading...", end=" ", flush=True) | ||
|
||
file = open(file).read().split("\n\n") | ||
to = open(to, 'w') | ||
|
||
print("Done.") | ||
print("Getting random elements...", end=" ", flush=True) | ||
|
||
sample = random.choices(file, k=number) | ||
|
||
print("Done.") | ||
print("Writing in destination file...", end=" ", flush=True) | ||
|
||
to.write("\n\n".join(sample)) | ||
|
||
print("Done.") |
Empty file.
Empty file.