Skip to content

Commit

Permalink
support SGVector<char>
Browse files Browse the repository at this point in the history
  • Loading branch information
sploving committed Jul 26, 2011
1 parent f5b05f4 commit 0654cea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Expand Up @@ -2,20 +2,19 @@ require 'shogun'
require 'load'

strings = {'hey','guys','i','am','a','string'}
parameter_list={{{strings}}}
parameter_list={{strings}}

function features_string_char_modular(strings)

for k, v in pairs(strings) do print(v) end
f=StringCharFeatures(strings, RAWBYTE)

print("max string length" ..f:get_max_vector_length())
--print "number of strings", f:get_num_vectors()
--print "length of first string", f:get_vector_length(0)
--print "strings", f.get_features()
print("max string length " ..f:get_max_vector_length())
print("number of strings " .. f:get_num_vectors())
--print ("length of first string" ..f:get_vector_length(0))
--print ("strings" .. f:get_features())

f:set_feature_vector({'t','e','s','t'}, 0)
f:set_feature_vector({"t","e","s","t"}, 0)

print ("strings" .. f:get_features())
return f:get_features(), f
end

Expand Down
1 change: 1 addition & 0 deletions src/interfaces/lua_modular/shogun.lua
Expand Up @@ -147,6 +147,7 @@ SerializableJsonFile = modshogun.SerializableJsonFile
SerializableXmlFil = modshogun.SerializableXmlFil
StringCharFeatures = modshogun.StringCharFeatures
DNA = modshogun.DNA
RAWBYTE = modshogun.RAWBYTE
ByteFeatures = modshogun.ByteFeatures
WordFeatures = modshogun.WordFeatures
AvgDiagKernelNormalizer = modshogun.AvgDiagKernelNormalizer
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/lua_modular/swig_typemaps.i
Expand Up @@ -75,6 +75,7 @@
%enddef

/* Define concrete examples of the TYPEMAP_SGVECTOR macros */
TYPEMAP_SGVECTOR(char)
TYPEMAP_SGVECTOR(uint8_t)
TYPEMAP_SGVECTOR(int32_t)
TYPEMAP_SGVECTOR(int16_t)
Expand Down Expand Up @@ -185,6 +186,7 @@ TYPEMAP_SGVECTOR(float64_t)
%enddef

/* Define concrete examples of the TYPEMAP_SGMATRIX macros */
TYPEMAP_SGMATRIX(char)
TYPEMAP_SGMATRIX(uint8_t)
TYPEMAP_SGMATRIX(int32_t)
TYPEMAP_SGMATRIX(int16_t)
Expand Down

0 comments on commit 0654cea

Please sign in to comment.