StringPreprocessor.h

Go to the documentation of this file.
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) 1999-2009 Soeren Sonnenburg
00008  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef _CSTRINGPREPROC__H__
00012 #define _CSTRINGPREPROC__H__
00013 
00014 #include <shogun/features/Features.h>
00015 #include <shogun/features/StringFeatures.h>
00016 #include <shogun/lib/common.h>
00017 #include <shogun/preprocessor/Preprocessor.h>
00018 
00019 namespace shogun
00020 {
00021 template <class ST> class CStringFeatures;
00022 
00030 template <class ST> class CStringPreprocessor : public CPreprocessor
00031 {
00032     public:
00035         CStringPreprocessor() : CPreprocessor() {}
00036 
00040         virtual bool apply_to_string_features(CFeatures* f)=0;
00041 
00043         virtual ST* apply_to_string(ST* f, int32_t &len)=0;
00044 
00046         inline virtual EFeatureClass get_feature_class() { return C_STRING; }
00048         inline virtual EFeatureType get_feature_type();
00049 
00051         virtual inline const char* get_name() const { return "UNKNOWN"; }
00052 
00054         virtual inline EPreprocessorType get_type() const { return P_UNKNOWN; }
00055 
00056 };
00057 
00058 template<> inline EFeatureType CStringPreprocessor<uint64_t>::get_feature_type()
00059 {
00060     return F_ULONG;
00061 }
00062 
00063 template<> inline EFeatureType CStringPreprocessor<int64_t>::get_feature_type()
00064 {
00065     return F_LONG;
00066 }
00067 
00068 template<> inline EFeatureType CStringPreprocessor<uint32_t>::get_feature_type()
00069 {
00070     return F_UINT;
00071 }
00072 
00073 template<> inline EFeatureType CStringPreprocessor<int32_t>::get_feature_type()
00074 {
00075     return F_INT;
00076 }
00077 
00078 template<> inline EFeatureType CStringPreprocessor<uint16_t>::get_feature_type()
00079 {
00080     return F_WORD;
00081 }
00082 
00083 template<> inline EFeatureType CStringPreprocessor<int16_t>::get_feature_type()
00084 {
00085     return F_WORD;
00086 }
00087 
00088 template<> inline EFeatureType CStringPreprocessor<uint8_t>::get_feature_type()
00089 {
00090     return F_BYTE;
00091 }
00092 
00093 template<> inline EFeatureType CStringPreprocessor<int8_t>::get_feature_type()
00094 {
00095     return F_BYTE;
00096 }
00097 
00098 template<> inline EFeatureType CStringPreprocessor<char>::get_feature_type()
00099 {
00100     return F_CHAR;
00101 }
00102 
00103 template<> inline EFeatureType CStringPreprocessor<bool>::get_feature_type()
00104 {
00105     return F_BOOL;
00106 }
00107 
00108 template<> inline EFeatureType CStringPreprocessor<float32_t>::get_feature_type()
00109 {
00110     return F_SHORTREAL;
00111 }
00112 
00113 template<> inline EFeatureType CStringPreprocessor<float64_t>::get_feature_type()
00114 {
00115     return F_DREAL;
00116 }
00117 
00118 template<> inline EFeatureType CStringPreprocessor<floatmax_t>::get_feature_type()
00119 {
00120     return F_LONGREAL;
00121 }
00122 
00123 }
00124 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation