Esempio n. 1
0
def match_line(line):
    db0 = time.clock()
    dbLines = DBLine.getAll()
    allLines = []
    for dbrecord in dbLines:
        allLines.append(dbrecord.to_numpy_array())
    log.debug('m_l db: '+str(time.clock()-db0)+'s')
    py0 = time.clock()

    result = pooling.run(allLines,line.to_numpy_array()) 
##    symbol = pooling.MPLine(allLines)
##    lines = symbol.matchLine(line.to_numpy_array())
    log.debug('m_l py: '+str(time.clock()-py0)+'s')
    pop0 = time.clock()
    #build set (might be buggy!)
    log.info('found %d matches out of %d records!'%(len(result),len(dbLines)))
    resultSet = set()
    for recordNumber in result:
        resultSet.add(dbLines[recordNumber].id)
    
    response = populate_lines(line, resultSet)
    log.debug('m_l pop: '+str(time.clock()-pop0)+'s')
    log.debug('m_l total: '+str(time.clock()-db0)+'s')
    return response