00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2007-2009 Christian Gehl 00008 * Written (W) 1999-2009 Soeren Sonnenburg 00009 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00010 */ 00011 00012 #ifndef _MANHATTANWORDDISTANCE_H___ 00013 #define _MANHATTANWORDDISTANCE_H___ 00014 00015 #include <shogun/lib/common.h> 00016 #include <shogun/features/Features.h> 00017 #include <shogun/features/StringFeatures.h> 00018 #include <shogun/distance/StringDistance.h> 00019 00020 namespace shogun 00021 { 00023 class CManhattanWordDistance: public CStringDistance<uint16_t> 00024 { 00025 public: 00027 CManhattanWordDistance(); 00028 00034 CManhattanWordDistance(CStringFeatures<uint16_t>* l, CStringFeatures<uint16_t>* r); 00035 virtual ~CManhattanWordDistance(); 00036 00043 virtual bool init(CFeatures* l, CFeatures* r); 00044 00046 virtual void cleanup(); 00047 00052 virtual EDistanceType get_distance_type() { return D_MANHATTANWORD; } 00053 00058 virtual const char* get_name() const { return "ManhattanWordDistance"; } 00059 00060 protected: 00064 float64_t compute(int32_t idx_a, int32_t idx_b); 00065 }; 00066 } // namespace shogun 00067 #endif /* _MANHATTANWORDDISTANCE_H___ */