static void setup_engine() { setup_fixture_path(); system("rm -Rf /tmp/valid-copy && cp -R fixtures/valid /tmp/valid-copy && chmod -R 755 /tmp/valid-copy"); item_cache_create(&item_cache, "/tmp/valid-copy", &item_cache_options); item_cache_load(item_cache); tagger_cache = create_tagger_cache(item_cache, NULL); tagger_cache->tag_retriever = &fetch_url; ce = create_classification_engine(item_cache, tagger_cache, &opts); }
static void setup(void) { setup_fixture_path(); read_document("fixtures/complete_tag.atom"); system("rm -Rf /tmp/valid-copy && cp -R fixtures/valid /tmp/valid-copy && chmod -R 755 /tmp/valid-copy"); item_cache_create(&item_cache, "/tmp/valid-copy", &item_cache_options); tagger = build_tagger(document, item_cache); train_tagger(tagger, item_cache); tagger->probability_function = &probability_function; assert_equal(TAGGER_TRAINED, tagger->state); random_background = new_pool(); }
static void read_document(void) { setup_fixture_path(); FILE *file; if (NULL != (file = fopen("fixtures/complete_tag.atom", "r"))) { fseek(file, 0, SEEK_END); int size = ftell(file); document = calloc(size, sizeof(char)); fseek(file, 0, SEEK_SET); fread(document, sizeof(char), size, file); document[size] = 0; fclose(file); } system("rm -Rf /tmp/valid-copy && cp -Rf fixtures/valid /tmp/valid-copy && chmod -R 755 /tmp/valid-copy"); item_cache_create(&item_cache, "/tmp/valid-copy", &item_cache_options); }
static void setup(void) { setup_fixture_path(); read_document("fixtures/complete_tag.atom"); random_background = new_pool(); system("rm -Rf /tmp/valid-copy && cp -R fixtures/valid /tmp/valid-copy && chmod -R 755 /tmp/valid-copy"); item_cache_create(&item_cache, "/tmp/valid-copy", &item_cache_options); tagger = build_tagger(document, item_cache); train_tagger(tagger, item_cache); tagger->probability_function = &naive_bayes_probability; tagger->classification_function = &mock_classify; precompute_tagger(tagger, random_background); assert_equal(TAGGER_PRECOMPUTED, tagger->state); classified_item = NULL; int freeit; item = item_cache_fetch_item(item_cache, (unsigned char*) "urn:peerworks.org:entry#709254", &freeit); }