Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Langford <jl@hunch.net>2012-11-28 22:23:51 +0400
committerJohn Langford <jl@hunch.net>2012-11-28 22:23:51 +0400
commit5c2a6d751efdb3fe91f5254cf49280af7549d229 (patch)
tree39dbdf9bd3e1f036b01cc2dbefde017e54867a12 /vowpalwabbit/vwdll.cpp
parent279130c2853294a28764fae347e9f7870ba39120 (diff)
windows testing and a bug fix from Rob
Diffstat (limited to 'vowpalwabbit/vwdll.cpp')
-rw-r--r--vowpalwabbit/vwdll.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/vowpalwabbit/vwdll.cpp b/vowpalwabbit/vwdll.cpp
index 6fcf899b..dd2bd793 100644
--- a/vowpalwabbit/vwdll.cpp
+++ b/vowpalwabbit/vwdll.cpp
@@ -35,6 +35,20 @@ extern "C"
catch (...)
{}
}
+
+ VW_DLL_MEMBER VW_EXAMPLE VW_CALLING_CONV VW_ImportExample(VW_HANDLE handle, VW_FEATURE_SPACE * features, size_t len)
+ {
+ try
+ {
+ vw * pointer = static_cast<vw*>(handle);
+ VW::primitive_feature_space * f = reinterpret_cast<VW::primitive_feature_space*>( features );
+ return static_cast<VW_EXAMPLE>(VW::import_example(*pointer, f, len));
+ }
+ catch (...)
+ {
+ return INVALID_VW_EXAMPLE;
+ }
+ }
VW_DLL_MEMBER VW_EXAMPLE VW_CALLING_CONV VW_ReadExample(VW_HANDLE handle, const char * line)
{
@@ -63,6 +77,34 @@ extern "C"
// BUGBUG: should report error here....
}
}
+
+ VW_DLL_MEMBER uint32_t VW_CALLING_CONV VW_HashSpace(VW_HANDLE handle, const char * s)
+ {
+ try
+ {
+ vw * pointer = static_cast<vw*>(handle);
+ string str(s);
+ return VW::hash_space(*pointer, str);
+ }
+ catch (...)
+ {
+ // BUGBUG: should report error here....
+ }
+ }
+
+ VW_DLL_MEMBER uint32_t VW_CALLING_CONV VW_HashFeature(VW_HANDLE handle, const char * s, unsigned long u)
+ {
+ try
+ {
+ vw * pointer = static_cast<vw*>(handle);
+ string str(s);
+ return VW::hash_feature(*pointer, str, u);
+ }
+ catch (...)
+ {
+ // BUGBUG: should report error here....
+ }
+ }
VW_DLL_MEMBER float VW_CALLING_CONV VW_Learn(VW_HANDLE handle, VW_EXAMPLE e)
{