diff options
author | Gordon Rios <gparker@gmail.com> | 2009-04-30 03:16:59 +0400 |
---|---|---|
committer | Gordon Rios <gparker@gmail.com> | 2009-04-30 03:16:59 +0400 |
commit | 89b6cd6a38264153ae425117e09ceff3d4d92b3e (patch) | |
tree | 86fd8a4de189f7fd09c414f5d82d7f583f97c792 /parse_example.h |
initial check in
Diffstat (limited to 'parse_example.h')
-rw-r--r-- | parse_example.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/parse_example.h b/parse_example.h new file mode 100644 index 00000000..03254dd6 --- /dev/null +++ b/parse_example.h @@ -0,0 +1,56 @@ +/* +Copyright (c) 2007 Yahoo! Inc. All rights reserved. The copyrights +embodied in the content of this file are licensed under the BSD +(revised) open source license + */ + +#ifndef PE_H +#define PE_H +#include "stack.h" +#include "io.h" +#include "parse_regressor.h" + +using namespace std; + +struct feature { + float x; + size_t weight_index; +}; + +struct substring { + char *start; + char *end; +}; + +struct thread_data { + size_t linesize; + char *line; + + v_array<substring> channels; + v_array<substring> words; + v_array<substring> name; + + v_array<size_t> indicies; + v_array<feature> atomics[256]; + bool *in_already; +}; + +struct example_file { + FILE* data; + io_buf cache; + bool write_cache; + size_t mask; +}; + +// Parse a string 'page_off' to extract features and label. +bool parse_example(thread_data &stuff, example_file &example_source, + regressor ®, v_array<feature> &features, + float &label, float &weight, v_array<char> &tag); + +bool inconsistent_cache(size_t numbits, io_buf &cache); + +void reset(size_t numbits, example_file &source); + +void finalize_source(example_file &source); + +#endif |