Last change
on this file since 31175 was 31175, checked in by davidb, 7 years ago |
Trial to find memory difference betwen Hashmap and Bloom filters
|
-
Property svn:executable
set to
*
|
File size:
1011 bytes
|
Line | |
---|
1 | package org.hathitrust.extractedfeatures;
|
---|
2 |
|
---|
3 |
|
---|
4 | import java.util.Scanner;
|
---|
5 |
|
---|
6 | public class DictionaryWhitelist {
|
---|
7 |
|
---|
8 | public static void main(String[] args)
|
---|
9 | {
|
---|
10 | Scanner scan = new Scanner(System.in);
|
---|
11 | System.out.println("Press enter to start:");
|
---|
12 | String wait = scan.nextLine();
|
---|
13 |
|
---|
14 | String dictionary_filename = "whitelist-placeholder.txt";
|
---|
15 |
|
---|
16 |
|
---|
17 | WhitelistBloomFilter whitelist = new WhitelistBloomFilter(dictionary_filename);
|
---|
18 | //WhitelistHashmap whitelist = new WhitelistHashmap(dictionary_filename);
|
---|
19 |
|
---|
20 | whitelist.storeEntries();
|
---|
21 |
|
---|
22 | System.out.println("Enter words to test (enter '.quit' to quit program");
|
---|
23 |
|
---|
24 | boolean quit = false;
|
---|
25 | while (!quit) {
|
---|
26 | String test_word = scan.next();
|
---|
27 | boolean might_contain_test = whitelist.contains(test_word);
|
---|
28 | if (test_word.equals(".quit")) {
|
---|
29 | quit = true;
|
---|
30 | }
|
---|
31 | else {
|
---|
32 | System.out.println("Whitelist ["+test_word+"] = " + might_contain_test);
|
---|
33 | }
|
---|
34 | }
|
---|
35 | scan.close();
|
---|
36 | System.out.println("Program ended.");
|
---|
37 | }
|
---|
38 |
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.