# for (i, segVal) in enumerate(np.unique(segments)):
# 	# construct a mask for the segment
# 	print "[x] inspecting segment %d" % (i)
# 	mask = np.zeros(image.shape[:2], dtype = "uint8")
# 	mask[segments == segVal] = 255
import numpy as np
import os

path = "/media/iglu/Data/DatasetIglu"
u = ['user1', 'user2', 'user3','user4', 'user5', 'user6', 'user7', 'user8', 'user9','user10']#
for mm in xrange(10):
    user = u[mm]
    if user == 'user4':
        continue
    with open(path + "/" + user+'/Objects.txt') as fp:
        for line in fp:
            print line[:-1]
    print ""
    for y in os.listdir(path + "/" + user):
        if (y != "Objects.txt") and not y.endswith(".zip") and not y.startswith("talk"):
            action = y
            print user+"_"+action
            f2 = open(path + "/" + user + "/" + action + "/speech.txt", 'r')
            speak = f2.readline()
            s = speak.split(" ")
            if s.__len__()!=1:
                continue
            #     speak=s[0]+" "
            #     label = raw_input("Label:")
            #     speak = speak + label
            # else:
            speak = speak[:-3]
            label = raw_input("Label:")
            speak = speak + " " + label
            f2.close()
            f2 = open(path + "/" + user + "/" + action + "/speech.txt", 'w')
            f2.write(speak)
            f2.close()
