Skip to content

Commit

Permalink
Scripts: Move to scripts/
Browse files Browse the repository at this point in the history
  • Loading branch information
Virinas-code committed Sep 21, 2021
1 parent 099fd56 commit 8516718
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions scripts/file_separator.py
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 modified scripts/start_basics.py
100644 → 100755
Empty file.
Empty file modified scripts/start_training.py
100644 → 100755
Empty file.

0 comments on commit 8516718

Please sign in to comment.