Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from sploving/master
add lua string features modular
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
examples/undocumented/lua_modular/features_string_char_modular.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'shogun' | ||
require 'load' | ||
|
||
strings = {'hey','guys','i','am','a','string'} | ||
parameter_list={{{strings}}} | ||
|
||
function features_string_char_modular(strings) | ||
|
||
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() | ||
|
||
f:set_feature_vector({'t','e','s','t'}, 0) | ||
|
||
print ("strings" .. f:get_features()) | ||
return f:get_features(), f | ||
end | ||
|
||
if debug.getinfo(3) == nill then | ||
print 'StringCharFeatures' | ||
features_string_char_modular(unpack(parameter_list[1])) | ||
end |