Skip to content

Commit

Permalink
Incomplete data loader
Browse files Browse the repository at this point in the history
  • Loading branch information
sitnin committed Oct 23, 2010
1 parent 51cafc8 commit 16eb3ca
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions datagen/datagen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,36 @@
sys.setdefaultencoding('utf-8')

import os
import fnmatch
import random


def load_data():
pass
def load_data(path):
data = list()
for filename in fnmatch.filter(os.listdir(path), "*.txt"):
with open(path+"/"+filename, "r") as f:
lines = f.read().splitlines()
f.close()
data.append((lines[0], lines[1:]))
return data

def run():
pass
def run(count, data):
def get_content(item):
text = ""
title = item[0]
for s in item[1]:
text += s+"\n"
return (title, text)

for x in xrange(count):


for item in data:
print(get_content(item))

def print_result():
def print_result(res):
pass


if __name__ == "__main__":
load_data()
run()
print_result()
print_result(run(100, load_data("data/")))

0 comments on commit 16eb3ca

Please sign in to comment.