PydMain

Python wrapper

extern (C)
void
PydMain
(
)

Examples

Unittests **/ /// Testing the hashin

document[] corp = [["asdahsk", "sdlfjsldj","çsldkfçk"],["sdjçlkj","sadjfl"],["sdfçls","oirgk", "sdkfj"]];
HashCorpus H = new HashCorpus(corp, "test_corpus");
assert("asdahsk" in H.encode_dictionary);

Test the loading of dictionaries

1 document[] corp = [
2     ["asdahsk", "sdlfjsldj", "çsldkfçk"], ["sdjçlkj", "sadjfl"],
3     ["sdfçls", "oirgk", "sdkfj"]
4 ];
5 HashCorpus H = new HashCorpus(corp, "test_corpus");
6 // Make a copy of the dictionaries
7 dictionary original_enc_dict = H.encode_dictionary;
8 Ddictionary original_dec_dict = H.decode_dictionary;
9 // Force the re-loading from disk again;
10 H._load_dictionaries();
11 foreach (word; [
12         "asdahsk", "sdlfjsldj", "çsldkfçk", "sdjçlkj", "sadjfl",
13         "sdfçls", "oirgk", "sdkfj"
14     ])
15 {
16     assert(original_enc_dict[word] == H.encode_dictionary[word]);
17 }
18 
19 assert(isAssociativeArray!(typeof(H.decode_dictionary)));
20 foreach (key, val; H.decode_dictionary)
21 {
22     assert(isSomeString!(typeof(key)));
23     assert(isArray!(typeof(val)));
24     assert(key in original_dec_dict);
25 }

Meta