diff options
author | John Langford <jl@hunch.net> | 2012-06-03 21:23:27 +0400 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2012-06-03 21:23:27 +0400 |
commit | 87bf4bc044ffafd8c6f5061a8a40a6a71e03398a (patch) | |
tree | 1c25a5dc0b38a2c4b2bbc426db2415a09b5dda1a /vowpalwabbit/vw.h | |
parent | 3ab7c47de5609e95efd5c540a2f395cf718e6647 (diff) |
bug free library example
Diffstat (limited to 'vowpalwabbit/vw.h')
-rw-r--r-- | vowpalwabbit/vw.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/vowpalwabbit/vw.h b/vowpalwabbit/vw.h index fc4c7412..20ebda9c 100644 --- a/vowpalwabbit/vw.h +++ b/vowpalwabbit/vw.h @@ -3,6 +3,7 @@ #include "global_data.h" #include "example.h" +#include "hash.h" namespace VW { vw initialize(string s); @@ -14,15 +15,20 @@ namespace VW { example* import_example(vw& all, vector< feature_space > ec_info); void finish_example(vw& all, example* ec); - inline uint32_t hasher(vw& all, string s, unsigned long u) + inline uint32_t hash_space(vw& all, string s) { substring ss; ss.begin = (char*)s.c_str(); ss.end = ss.begin + s.length(); - return all.p->hasher(ss,u); + return all.p->hasher(ss,hash_base); + } + inline uint32_t hash_feature(vw& all, string s, unsigned long u) + { + substring ss; + ss.begin = (char*)s.c_str(); + ss.end = ss.begin + s.length(); + return all.p->hasher(ss,u) & all.parse_mask; } - const uint32_t hash_base = 97562527; - } #endif |