def testSentence(method, neighborsWeight, wordsInSentenceWeight, similarWordsWeight, 
                timeBeforeWeight, timeAfterWeight, timeDistance, 
                posInSentenceWeight, 
                durationWeight):

    l.importFromFile('association_test_db_short.txt', 1)#association_test_db_full.txt', 1)#minimal_db.txt')#roads_articulation_db.txt')#
    predicate = 'to'#'parents'#random.choice(list(l.words))
    print 'predicate', predicate
    sentence = [predicate]
    timeThen = time.time()
    numWords = 8
    for i in range(numWords):
        posInSentence = i/float(numWords-1)
        posInSentenceWidth = 0.2
        if posInSentence < 0.5:
            preferredDuration = posInSentence*20 # longer words in the middle of a sentence (just as a test...)
        else:
            preferredDuration = (1-posInSentence)*20
        preferredDurationWidth = 3
        predicate = generate(predicate, method, neighborsWeight, wordsInSentenceWeight, similarWordsWeight, 
                            timeBeforeWeight, timeAfterWeight, timeDistance, 
                            posInSentence, posInSentenceWidth, posInSentenceWeight, 
                            preferredDuration, preferredDurationWidth, durationWeight)
        sentence.append(predicate)
    print 'sentence', sentence
    print 'processing time for %i words: %f secs'%(numWords, time.time() - timeThen)
Esempio n. 2
0
def testSentence(method, neighborsWeight, wordsInSentenceWeight,
                 similarWordsWeight, timeBeforeWeight, timeAfterWeight,
                 timeDistance, posInSentenceWeight, durationWeight):

    l.importFromFile(
        'association_test_db_short.txt', 1
    )  #association_test_db_full.txt', 1)#minimal_db.txt')#roads_articulation_db.txt')#
    predicate = 'to'  #'parents'#random.choice(list(l.words))
    print 'predicate', predicate
    sentence = [predicate]
    timeThen = time.time()
    numWords = 8
    for i in range(numWords):
        posInSentence = i / float(numWords - 1)
        posInSentenceWidth = 0.2
        if posInSentence < 0.5:
            preferredDuration = posInSentence * 20  # longer words in the middle of a sentence (just as a test...)
        else:
            preferredDuration = (1 - posInSentence) * 20
        preferredDurationWidth = 3
        predicate = generate(predicate, method, neighborsWeight,
                             wordsInSentenceWeight, similarWordsWeight,
                             timeBeforeWeight, timeAfterWeight, timeDistance,
                             posInSentence, posInSentenceWidth,
                             posInSentenceWeight, preferredDuration,
                             preferredDurationWidth, durationWeight)
        sentence.append(predicate)
    print 'sentence', sentence
    print 'processing time for %i words: %f secs' % (numWords,
                                                     time.time() - timeThen)
def testSentence(method):
    l.importFromFile('association_test_db_full.txt', 1)#minimal_db.txt')#roads_articulation_db.txt')#
    predicate = random.choice(list(l.words))
    print 'predicate', predicate
    sentence = [predicate]
    for i in range(12):
        predicate = generate(predicate, method)
        sentence.append(predicate)
        print 'sentence', sentence
Esempio n. 4
0
def testSentence(method, neighborsWeight, wordsInSentenceWeight, similarWordsWeight, timeBeforeWeight, timeAfterWeight, timeDistance):
    l.importFromFile('association_test_db_short.txt', 1)#association_test_db_full.txt', 1)#minimal_db.txt')#roads_articulation_db.txt')#
    predicate = 'to'#'parents'#random.choice(list(l.words))
    print 'predicate', predicate
    sentence = [predicate]
    for i in range(8):
        predicate = generate(predicate, method, neighborsWeight, wordsInSentenceWeight, similarWordsWeight, timeBeforeWeight, timeAfterWeight, timeDistance)
        sentence.append(predicate)
    print 'sentence', sentence
Esempio n. 5
0
def testSentence(method, nW, wW, sW):
    l.importFromFile('association_test_db_full.txt',
                     1)  #minimal_db.txt')#roads_articulation_db.txt')#
    predicate = 'parents'  #random.choice(list(l.words))
    print 'predicate', predicate
    sentence = [predicate]
    for i in range(8):
        predicate = generate(predicate, method, nW, wW, sW)
        sentence.append(predicate)
    print 'sentence', sentence
def testSentence(method, neighborsWeight, wordsInSentenceWeight, similarWordsWeight, timeBeforeWeight, timeAfterWeight, timeDistance, posInSentenceWeight, durationWeight):
    l.importFromFile('association_test_db_short.txt', 1)#association_test_db_full.txt', 1)#minimal_db.txt')#roads_articulation_db.txt')#
    predicate = 'to'#'parents'#random.choice(list(l.words))
    print 'predicate', predicate
    sentence = [predicate]
    timeThen = time.time()
    numWords = 8
    for i in range(numWords):
        predicate = generate(predicate, method, neighborsWeight, wordsInSentenceWeight, similarWordsWeight, timeBeforeWeight, timeAfterWeight, timeDistance, posInSentenceWeight, durationWeight)
        sentence.append(predicate)
    print 'sentence', sentence
    print 'processing time for %i words: %f secs'%(numWords, time.time() - timeThen)
def testSentence(predicate, numWords, method, neighborsWeight,
                 wordsInSentenceWeight, similarWordsWeight, timeBeforeWeight,
                 timeAfterWeight, timeDistance, posInSentenceWeight,
                 durationWeight, method2, neighborsWeight2,
                 wordsInSentenceWeight2, similarWordsWeight2,
                 timeBeforeWeight2, timeAfterWeight2, timeDistance2,
                 posInSentenceWeight2, durationWeight2):

    l.importFromFile(
        'association_test_db_short.txt', 1
    )  #association_test_db_full.txt', 1)#minimal_db.txt')#roads_articulation_db.txt')#
    print 'predicate', predicate
    sentence = [predicate]
    secondaryStream = []
    timeThen = time.time()
    for i in range(numWords):
        posInSentence = i / float(numWords - 1)
        posInSentenceWidth = 0.2
        if posInSentence < 0.5:
            preferredDuration = posInSentence * 20  # longer words in the middle of a sentence (just as a test...)
        else:
            preferredDuration = (1 - posInSentence) * 20
        preferredDurationWidth = 3
        prevPredicate = predicate  # save it for the secondary association
        predicate = generate(predicate, method, neighborsWeight,
                             wordsInSentenceWeight, similarWordsWeight,
                             timeBeforeWeight, timeAfterWeight, timeDistance,
                             posInSentence, posInSentenceWidth,
                             posInSentenceWeight, preferredDuration,
                             preferredDurationWidth, durationWeight)
        sentence.append(predicate)
        # secondary association for the same predicate
        posInSentence2 = posInSentence
        posInSentenceWidth2 = posInSentenceWidth
        preferredDuration2 = preferredDuration * 3
        preferredDurationWidth2 = preferredDurationWidth
        secondaryAssoc = generate(prevPredicate, method2, neighborsWeight2,
                                  wordsInSentenceWeight2, similarWordsWeight2,
                                  timeBeforeWeight2, timeAfterWeight2,
                                  timeDistance2, posInSentence2,
                                  posInSentenceWidth2, posInSentenceWeight2,
                                  preferredDuration2, preferredDurationWidth2,
                                  durationWeight2)
        secondaryStream.append(secondaryAssoc)
    print 'sentence', sentence
    print 'secondaryStream', secondaryStream
    print 'processing time for %i words: %f secs' % (numWords,
                                                     time.time() - timeThen)
Esempio n. 8
0
def testSentence(method, neighborsWeight, wordsInSentenceWeight,
                 similarWordsWeight, timeBeforeWeight, timeAfterWeight,
                 timeDistance, posInSentenceWeight, durationWeight):
    l.importFromFile(
        'association_test_db_short.txt', 1
    )  #association_test_db_full.txt', 1)#minimal_db.txt')#roads_articulation_db.txt')#
    predicate = 'to'  #'parents'#random.choice(list(l.words))
    print 'predicate', predicate
    sentence = [predicate]
    timeThen = time.time()
    numWords = 8
    for i in range(numWords):
        predicate = generate(predicate, method, neighborsWeight,
                             wordsInSentenceWeight, similarWordsWeight,
                             timeBeforeWeight, timeAfterWeight, timeDistance,
                             posInSentenceWeight, durationWeight)
        sentence.append(predicate)
    print 'sentence', sentence
    print 'processing time for %i words: %f secs' % (numWords,
                                                     time.time() - timeThen)
def testSentence(predicate, numWords, method, neighborsWeight, wordsInSentenceWeight, similarWordsWeight, 
                timeBeforeWeight, timeAfterWeight, timeDistance, 
                posInSentenceWeight, 
                durationWeight,
                method2, neighborsWeight2, wordsInSentenceWeight2, similarWordsWeight2, 
                timeBeforeWeight2, timeAfterWeight2, timeDistance2, 
                posInSentenceWeight2, 
                durationWeight2):

    l.importFromFile('association_test_db_short.txt', 1)#association_test_db_full.txt', 1)#minimal_db.txt')#roads_articulation_db.txt')#
    print 'predicate', predicate
    sentence = [predicate]
    secondaryStream = []
    timeThen = time.time()
    for i in range(numWords):
        posInSentence = i/float(numWords-1)
        posInSentenceWidth = 0.2
        if posInSentence < 0.5:
            preferredDuration = posInSentence*20 # longer words in the middle of a sentence (just as a test...)
        else:
            preferredDuration = (1-posInSentence)*20
        preferredDurationWidth = 3
        prevPredicate = predicate # save it for the secondary association
        predicate = generate(predicate, method, neighborsWeight, wordsInSentenceWeight, similarWordsWeight, 
                            timeBeforeWeight, timeAfterWeight, timeDistance, 
                            posInSentence, posInSentenceWidth, posInSentenceWeight, 
                            preferredDuration, preferredDurationWidth, durationWeight)
        sentence.append(predicate)
        # secondary association for the same predicate
        posInSentence2 = posInSentence
        posInSentenceWidth2 = posInSentenceWidth
        preferredDuration2 = preferredDuration*3
        preferredDurationWidth2 = preferredDurationWidth
        secondaryAssoc = generate(prevPredicate, method2, neighborsWeight2, wordsInSentenceWeight2, similarWordsWeight2, 
                            timeBeforeWeight2, timeAfterWeight2, timeDistance2, 
                            posInSentence2, posInSentenceWidth2, posInSentenceWeight2, 
                            preferredDuration2, preferredDurationWidth2, durationWeight2)
        secondaryStream.append(secondaryAssoc)
    print 'sentence', sentence
    print 'secondaryStream', secondaryStream
    print 'processing time for %i words: %f secs'%(numWords, time.time() - timeThen)