// // $Id: mapper.h 4143 2008-12-08 23:23:55Z abehm $ // // mapper.h // // Copyright (C) 2003 - 2007 by The Regents of the University of // California // // Redistribution of this file is permitted under the terms of the // BSD license // // Date: March 2002 // // Authors: // Chen Li (chenli (at) ics.uci.edu) // Liang Jin (liangj (at) ics.uci.edu) // #ifndef __MAPPER_H__ #define __MAPPER_H__ #include #include using namespace std; typedef vector Coordinates; // compute the edit distance between two strings int ed(string s1, string s2); bool SimilarString(string s1, string s2, int threshold); class Mapper { public: Mapper(vector &, int dimensionality); Mapper(const string dataFileName); ~Mapper(); void map(); // map strings to a Euclidiean space vector getStrings(); void saveToFile(const string dataFileName); // save data to a file // compute the new coordinates for a given string Coordinates mappedCoordinates(string s); // compute the distance of two strings in the mapped space double mappedDistance(const string s1, const string s2); double getNewThreshold(const vector &stringVector1, const vector &stringVector2, const int edThreshold); double getNewThreshold(const vector &stringVector1, const double percetange1, const vector &stringVector2, const double percentages, const int edThreshold); private: vector stringVector; vector< Coordinates > coordinatesVector; int size; double threshold; int dimensionality; // these two vectors store the pairs of pivots vector pivotsA; vector pivotsB; //double getCoordindate(int stringID, int dimensionID); //void setCoordindate(int stringID, int dimensionID, double coord); void nextsm(int); // find a point farthest to the point id using distances up to "dimLimit" int findFarthestPoint(int id, int dimLimit); void choosePivot(int dim); }; #endif // __MAPPER_H__