SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
preprocessor
StringPreprocessor.h
浏览该文件的文档.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* Written (W) 1999-2009 Soeren Sonnenburg
8
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9
*/
10
11
#ifndef _CSTRINGPREPROC__H__
12
#define _CSTRINGPREPROC__H__
13
14
#include <
shogun/features/Features.h
>
15
#include <
shogun/features/StringFeatures.h
>
16
#include <
shogun/lib/common.h
>
17
#include <
shogun/preprocessor/Preprocessor.h
>
18
19
namespace
shogun
20
{
21
template
<
class
ST>
class
CStringFeatures;
22
30
template
<
class
ST>
class
CStringPreprocessor
:
public
CPreprocessor
31
{
32
public
:
35
CStringPreprocessor
() :
CPreprocessor
() {}
36
40
virtual
bool
apply_to_string_features
(
CFeatures
* f)=0;
41
43
virtual
ST*
apply_to_string
(ST* f, int32_t &len)=0;
44
46
virtual
EFeatureClass
get_feature_class
() {
return
C_STRING
; }
48
virtual
EFeatureType
get_feature_type
();
49
51
virtual
const
char
*
get_name
()
const
{
return
"UNKNOWN"
; }
52
54
virtual
EPreprocessorType
get_type
()
const
{
return
P_UNKNOWN
; }
55
56
};
57
58
template
<>
inline
EFeatureType
CStringPreprocessor<uint64_t>::get_feature_type
()
59
{
60
return
F_ULONG
;
61
}
62
63
template
<>
inline
EFeatureType
CStringPreprocessor<int64_t>::get_feature_type
()
64
{
65
return
F_LONG
;
66
}
67
68
template
<>
inline
EFeatureType
CStringPreprocessor<uint32_t>::get_feature_type
()
69
{
70
return
F_UINT
;
71
}
72
73
template
<>
inline
EFeatureType
CStringPreprocessor<int32_t>::get_feature_type
()
74
{
75
return
F_INT
;
76
}
77
78
template
<>
inline
EFeatureType
CStringPreprocessor<uint16_t>::get_feature_type
()
79
{
80
return
F_WORD
;
81
}
82
83
template
<>
inline
EFeatureType
CStringPreprocessor<int16_t>::get_feature_type
()
84
{
85
return
F_WORD
;
86
}
87
88
template
<>
inline
EFeatureType
CStringPreprocessor<uint8_t>::get_feature_type
()
89
{
90
return
F_BYTE
;
91
}
92
93
template
<>
inline
EFeatureType
CStringPreprocessor<int8_t>::get_feature_type
()
94
{
95
return
F_BYTE
;
96
}
97
98
template
<>
inline
EFeatureType
CStringPreprocessor<char>::get_feature_type
()
99
{
100
return
F_CHAR
;
101
}
102
103
template
<>
inline
EFeatureType
CStringPreprocessor<bool>::get_feature_type
()
104
{
105
return
F_BOOL
;
106
}
107
108
template
<>
inline
EFeatureType
CStringPreprocessor<float32_t>::get_feature_type
()
109
{
110
return
F_SHORTREAL
;
111
}
112
113
template
<>
inline
EFeatureType
CStringPreprocessor<float64_t>::get_feature_type
()
114
{
115
return
F_DREAL
;
116
}
117
118
template
<>
inline
EFeatureType
CStringPreprocessor<floatmax_t>::get_feature_type
()
119
{
120
return
F_LONGREAL
;
121
}
122
123
}
124
#endif
SHOGUN
机器学习工具包 - 项目文档