Пример #1
0
def runKWS(query, imagePath, svgPath):
    svc = SVGCropper()
    fe = FeatureExtractor()
    result = []
    #set threshold here
    threshold = 40
    output = ""
    print("Cropping the segments")

    keywordsList = svc.cropWords(imagePath, svgPath)
    fq = fe.getFeatureVector(query)

    dists = []
    for keyword in keywordsList:
        f = fe.getFeatureVector(keyword[0])
        dist, path = fastdtw(f, fq, dist=euclidean)
        print "distance from ", keyword[1], " : ", dist
        dists.append(dist)
        output += keyword[1] + "," + str(dist) + " "

    return output