Ejemplo n.º 1
0
body = inFile.read()
inFile.close()
testBoundaries, testText = parseSentenceBoundaries(body)

print "About to create training data."
trainingData = Processor.parseMultipleTrainingDocStrings(
    trainingDocs, trainingBoundaries, maxSideLength, maxSideLength)
print "Training data created."

print "About to create test data."
testData = Processor.parseSingleTrainingDocString(testText, testBoundaries,
                                                  maxSideLength, maxSideLength)
print "Test data created."

print "About to create npArrays."
trainingPoints, trainingBoundariesVector = TensorflowUtils.createTrainingArrays(
    trainingData, maxSideLength, maxSideLength)
testPoints, testBoundariesVector = TensorflowUtils.createTrainingArrays(
    testData, maxSideLength, maxSideLength)
print "npArrays created."

# Define the tensorflow graph
# Initially only train on threshold weight.

print "Defining tensorflow graph."
tfMaxSideLength = maxSideLength

numNeighbors = tf.placeholder("int32")
tfThresholdWeight = tf.placeholder("float32")
tfNumPreceeding = tf.placeholder(dtype="int32")
tfNumFollowing = tf.placeholder(dtype="int32")