Ejemplo n.º 1
0
END_TEST

START_TEST (test_load_tagger_from_tag_definition_document_sets_classifier_taggings_url) {
    Tagger *tagger = build_tagger(document, item_cache);
    assert_not_null(tagger->classifier_taggings_url);
    assert_equal_s("http://localhost:8888/results", tagger->classifier_taggings_url);
}
Ejemplo n.º 2
0
END_TEST

START_TEST (test_load_tagging_from_tag_definition_document_set_tagger_term) {
    Tagger *tagger = build_tagger(document, item_cache);
    assert_not_null(tagger->term);
    assert_equal_s("a-religion", tagger->term);
}
Ejemplo n.º 3
0
END_TEST

START_TEST (test_loads_right_negative_examples) {
    Tagger *tagger = build_tagger(document, item_cache);
    assert_not_null(tagger->negative_examples);
    assert_equal_s("urn:peerworks.org:entry#880389", tagger->negative_examples[0]);
}
Ejemplo n.º 4
0
END_TEST

START_TEST (test_load_tagger_from_tag_definition_document_sets_training_url) {
    Tagger *tagger = build_tagger(document, item_cache);
    assert_not_null(tagger->training_url);
    assert_equal_s("http://trunk.mindloom.org:80/seangeo/tags/a-religion/training.atom", tagger->training_url);
}
Ejemplo n.º 5
0
END_TEST

START_TEST (test_load_tagging_from_tag_definition_document_set_tagger_scheme) {
    Tagger *tagger = build_tagger(document, item_cache);
    assert_not_null(tagger->scheme);
    assert_equal_s("http://trunk.mindloom.org:80/seangeo/tags/", tagger->scheme);
}
Ejemplo n.º 6
0
END_TEST

START_TEST (test_loads_right_positive_examples) {
    Tagger *tagger = build_tagger(document, item_cache);
    assert_not_null(tagger->positive_examples);
    assert_equal_s("urn:peerworks.org:entry#753459", tagger->positive_examples[0]);
    assert_equal_s("urn:peerworks.org:entry#886294", tagger->positive_examples[1]);
    assert_equal_s("urn:peerworks.org:entry#888769", tagger->positive_examples[2]);
    assert_equal_s("urn:peerworks.org:entry#884409", tagger->positive_examples[3]);
}
Ejemplo n.º 7
0
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();
}
Ejemplo n.º 8
0
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);
}
Ejemplo n.º 9
0
END_TEST

START_TEST (test_load_tagger_from_tag_definition_document_sets_bias) {
    Tagger *tagger = build_tagger(document, item_cache);
    assert_equal_f(1.2, tagger->bias);
}
Ejemplo n.º 10
0
END_TEST

START_TEST (test_load_tagger_from_tag_definition_document_sets_updated) {
    Tagger *tagger = build_tagger(document, item_cache);
    assert_equal(1206840258, tagger->updated);
}
Ejemplo n.º 11
0
END_TEST

START_TEST (test_loads_right_number_of_negative_examples) {
    Tagger *tagger = build_tagger(document, item_cache);
    assert_equal(1, tagger->negative_example_count);
}