tribler.test_unit.core.database.test_augmenter

Classes

TestAugmentedSearch

Tests for augmenting queries.

Module Contents

class tribler.test_unit.core.database.test_augmenter.TestAugmentedSearch

Bases: ipv8.test.base.TestBase

Tests for augmenting queries.

setUp() None

Create a mock config and an AugmentedSearch setup.

async test_write_cache_on_shutdown() None

Test if an incomplete title window is flushed to disk before shutting down.

test_title_trunc() None

Test if long torrent titles are truncated.

test_schedule_study() None

Test if a study is scheduled when we have sufficient training data.

test_schedule_study_from_cache() None

Test if the cache file is checked after a restart for pending training data.

async test_study() None

Test if learning is actually taking place. Warning: id assignment and exact vocabulary are non-deterministic!

test_needs_kickstart() None

Test if an uninitialized augmenter asks for a kickstart.

test_needs_kickstart_initialized_empty() None

Test if an initialized-but-empty augmenter asks for a kickstart.

async test_needs_kickstart_initialized() None

Test if an initialized augmenter signals no need for a kickstart.

test_to_phrases() None

Test if pieces are correctly mapped to phrases.

test_augment() None

Test if a full e2e enhancement works. With a fixed vocabulary/model, this is deterministic!

Explanation for the “test_augment is testing!” transformation:
  1. We load the vocabulary from test_study, which is trained on the unigram “test”. However, note that “augm” and “ing!” have also snuck their way into the vocabulary.

1. We parse three words (into as many phrases) “test_augment”, “is”, “testing!” and output their conjuction. 2.a. The first disjunction permutates [“test”, “_”, “augm”, “e”, “n”, “t”]. 2.b. The second is [“i”, “s”]. Both symbols are completely unknown to our vocabulary. 2.c. The third is [“test”, “ing!”].