def genVocab20(d, seed): """Vocabulary for 20 base words.""" numwords = 20 vocab = [[None,None] for i in range(numwords*2)] PDFTools.setSeed(seed) # for i in range(numwords): # vocab[i][1] = genVector(d) vocab = fillVectors(vocab, d, numwords, RPMutils.VECTOR_SIMILARITY) PDFTools.setSeed(long(time.time())) #attributes vocab[0][0] = "shape" vocab[1][0] = "number" vocab[2][0] = "size" vocab[3][0] = "orientation" vocab[4][0] = "position" #values #vocab[5][0] = "small" #vocab[6][0] = "medium" #vocab[7][0] = "large" vocab[8][0] = "zero" vocab[9][0] = "one" vocab[10][0] = "plusone" vocab[11][0] = "horizontal" vocab[12][0] = "vertical" vocab[13][0] = "oblique" # vocab[14][0] = vocab[15][0] = "circle" vocab[16][0] = "square" vocab[17][0] = "diamond" vocab[18][0] = "triangle" vocab[19][0] = "rubbish" #now the higher level vocabulary vocab[20][0] = "two" vocab[20][1] = RPMutils.normalize(RPMutils.cconv(vocab[9][1], vocab[10][1])) vocab[21][0] = "three" vocab[21][1] = RPMutils.normalize(RPMutils.cconv(vocab[20][1], vocab[10][1])) vocab[22][0] = "four" vocab[22][1] = RPMutils.normalize(RPMutils.cconv(vocab[21][1], vocab[10][1])) output = open(RPMutils.vocabFile(d, numwords, seed), "w") for i in range(len(vocab)): if vocab[i][0] != None: output.write(vocab[i][0] + " " + RPMutils.floatlist2str(vocab[i][1]) + "\n") output.close()
def genVocab50(d, seed): """Vocabulary for 50 base words.""" numwords = 50 vocab = [[None,None] for i in range(numwords*2)] PDFTools.setSeed(seed) # for i in range(numwords): # vocab[i][1] = genVector(d) vocab = fillVectors(vocab, d, numwords, RPMutils.VECTOR_SIMILARITY) PDFTools.setSeed(long(time.time())) #attributes vocab[0][0] = "shape" vocab[1][0] = "number" vocab[2][0] = "linestroke" vocab[3][0] = "angle" vocab[4][0] = "length" vocab[5][0] = "rpos" vocab[6][0] = "hpos" vocab[7][0] = "vpos" vocab[8][0] = "shading" vocab[9][0] = "existence" vocab[10][0] = "linetype" vocab[11][0] = "width" #values #misc vocab[12][0] = "present" vocab[13][0] = "null" vocab[14][0] = "rubbish" #number vocab[15][0] = "zero" vocab[16][0] = "one" vocab[17][0] = "plusone" #angle vocab[18][0] = "0deg" vocab[19][0] = "plus45deg" #shape vocab[20][0] = "circle" vocab[21][0] = "square" vocab[22][0] = "diamond" vocab[23][0] = "dot" vocab[24][0] = "triangle" vocab[25][0] = "cross" vocab[26][0] = "X" vocab[27][0] = "rectangle" #linestroke vocab[28][0] = "normal" vocab[29][0] = "dashed" vocab[30][0] = "bold" #linetype vocab[31][0] = "straight" vocab[32][0] = "curved" vocab[33][0] = "wavy" # vocab[34][0] = #length vocab[35][0] = "short" vocab[36][0] = "longer" #radialpos/horizopos/verticpos vocab[37][0] = "rinner" vocab[38][0] = "hleft" vocab[39][0] = "vbottom" vocab[40][0] = "moveout" vocab[41][0] = "moveright" vocab[42][0] = "moveup" #shading vocab[43][0] = "none" vocab[44][0] = "solid" vocab[45][0] = "lefthatch" vocab[46][0] = "righthatch" vocab[47][0] = "crosshatch" vocab[48][0] = "vertical" vocab[49][0] = "horizontal" #now the higher level vocabulary vocab[50][0] = "two" vocab[50][1] = RPMutils.normalize(RPMutils.cconv(vocab[16][1], vocab[17][1])) vocab[51][0] = "three" vocab[51][1] = RPMutils.normalize(RPMutils.cconv(vocab[50][1], vocab[17][1])) vocab[52][0] = "four" vocab[52][1] = RPMutils.normalize(RPMutils.cconv(vocab[51][1], vocab[17][1])) vocab[55][0] = "45deg" vocab[55][1] = RPMutils.normalize(RPMutils.cconv(vocab[18][1], vocab[19][1])) vocab[56][0] = "90deg" vocab[56][1] = RPMutils.normalize(RPMutils.cconv(vocab[55][1], vocab[19][1])) vocab[57][0] = "135deg" vocab[57][1] = RPMutils.normalize(RPMutils.cconv(vocab[56][1], vocab[19][1])) vocab[58][0] = "180deg" vocab[58][1] = RPMutils.normalize(RPMutils.cconv(vocab[57][1], vocab[19][1])) vocab[59][0] = "225deg" vocab[59][1] = RPMutils.normalize(RPMutils.cconv(vocab[58][1], vocab[19][1])) vocab[60][0] = "270deg" vocab[60][1] = RPMutils.normalize(RPMutils.cconv(vocab[59][1], vocab[19][1])) vocab[61][0] = "315deg" vocab[61][1] = RPMutils.normalize(RPMutils.cconv(vocab[60][1], vocab[19][1])) vocab[65][0] = "rmiddle" vocab[65][1] = RPMutils.normalize(RPMutils.cconv(vocab[37][1], vocab[40][1])) vocab[66][0] = "router" vocab[66][1] = RPMutils.normalize(RPMutils.cconv(vocab[65][1], vocab[40][1])) vocab[67][0] = "hmiddle" vocab[67][1] = RPMutils.normalize(RPMutils.cconv(vocab[38][1], vocab[41][1])) vocab[68][0] = "hright" vocab[68][1] = RPMutils.normalize(RPMutils.cconv(vocab[67][1], vocab[41][1])) vocab[69][0] = "vmiddle" vocab[69][1] = RPMutils.normalize(RPMutils.cconv(vocab[39][1], vocab[42][1])) vocab[70][0] = "vtop" vocab[70][1] = RPMutils.normalize(RPMutils.cconv(vocab[69][1], vocab[42][1])) vocab[71][0] = "medium" vocab[71][1] = RPMutils.normalize(RPMutils.cconv(vocab[35][1], vocab[36][1])) vocab[72][0] = "long" vocab[72][1] = RPMutils.normalize(RPMutils.cconv(vocab[71][1], vocab[36][1])) output = open(RPMutils.vocabFile(d, numwords, seed), "w") for i in range(len(vocab)): if vocab[i][0] != None: output.write(vocab[i][0] + " " + RPMutils.floatlist2str(vocab[i][1]) + "\n") output.close()