ShortFeatures.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-2008 Soeren Sonnenburg
00008  * Written (W) 1999-2008 Gunnar Raetsch
00009  * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
00010  */
00011 
00012 #ifndef _SHORTFEATURES__H__
00013 #define _SHORTFEATURES__H__
00014 
00015 #include "features/SimpleFeatures.h"
00016 #include "features/CharFeatures.h"
00017 #include "lib/common.h"
00018 
00023 class CShortFeatures : public CSimpleFeatures<int16_t>
00024 {
00025     public:
00030         CShortFeatures(int32_t size=0);
00031 
00033         CShortFeatures(const CShortFeatures & orig);
00034 
00042         inline CShortFeatures(int16_t* src, int32_t num_feat, int32_t num_vec): CSimpleFeatures<int16_t>(0)
00043         {
00044             CSimpleFeatures<int16_t>::copy_feature_matrix(src, num_feat, num_vec);
00045         }
00046 
00051         CShortFeatures(char* fname);
00052 
00061         bool obtain_from_char_features(CCharFeatures* cf, int32_t start, int32_t order, int32_t gap=0);
00062 
00067         virtual EFeatureType get_feature_type() { return F_SHORT; }
00068 
00077         inline virtual void copy_feature_matrix(int16_t* src, int32_t num_feat, int32_t num_vec)
00078         {
00079             CSimpleFeatures<int16_t>::copy_feature_matrix(src, num_feat, num_vec);
00080         }
00081 
00087         virtual bool load(char* fname);
00088 
00094         virtual bool save(char* fname);
00095     protected:
00105         void translate_from_single_order(int16_t* obs, int32_t sequence_length, int32_t start, int32_t order, int32_t max_val, int32_t gap);
00106 };
00107 #endif

SHOGUN Machine Learning Toolbox - Documentation