Skip to content

Commit

Permalink
Merge pull request VowpalWabbit#987 from vjeranc/fix_affix
Browse files Browse the repository at this point in the history
bugfix - namespace now stores 16 instead of just 2 affixes
  • Loading branch information
JohnLangford committed May 3, 2016
2 parents 1af8a55 + 25e8cd7 commit 5990d9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vowpalwabbit/global_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ struct vw
uint32_t skips[256];//skips in ngrams.
std::vector<std::string> limit_strings; // descriptor of feature limits
uint32_t limit[256];//count to limit features by
char affix_features[256]; // affixes to generate (up to 8 per namespace)
uint64_t affix_features[256]; // affixes to generate (up to 16 per namespace - 4 bits per affix)
bool spelling_features[256]; // generate spelling features for which namespace
vector<string> dictionary_path; // where to look for dictionaries
vector<feature_dict*> namespace_dictionaries[256]; // each namespace has a list of dictionaries attached to it
Expand Down
6 changes: 3 additions & 3 deletions vowpalwabbit/parse_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TC_parser
unsigned char (*redefine)[256];
parser* p;
example* ae;
char* affix_features;
uint64_t* affix_features;
bool* spelling_features;
v_array<char> spelling;

Expand Down Expand Up @@ -110,10 +110,10 @@ class TC_parser
features& affix_fs = ae->feature_space[affix_namespace];
if (affix_fs.size() == 0)
ae->indices.push_back(affix_namespace);
char affix = affix_features[index];
uint64_t affix = affix_features[index];
while (affix > 0)
{ bool is_prefix = affix & 0x1;
char len = (affix >> 1) & 0x7;
uint64_t len = (affix >> 1) & 0x7;
substring affix_name = { feature_name.begin, feature_name.end };
if (affix_name.end > affix_name.begin + len)
{ if (is_prefix)
Expand Down

0 comments on commit 5990d9b

Please sign in to comment.