-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tool to dedupilate corpus with hashing
- Loading branch information
CHRISTOPHER DYER
authored and
CHRISTOPHER DYER
committed
Feb 4, 2015
1 parent
c485a6b
commit afd6584
Showing
4 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
utils/dedup_corpus | ||
klm/lm/builder/dump_counts | ||
klm/util/cat_compressed | ||
example_extff/ff_example.lo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <iostream> | ||
#include "hash.h" | ||
|
||
using namespace std; | ||
|
||
#define INITIAL_SIZE 20000000 | ||
|
||
int main(int argc, char **argv) { | ||
if (argc != 1) { | ||
cerr << "Usage: " << argv[0] << " < file.txt\n"; | ||
return 1; | ||
} | ||
SPARSE_HASH_SET<uint64_t> seen(INITIAL_SIZE); | ||
string line; | ||
while(getline(cin, line)) { | ||
uint64_t h = cdec::MurmurHash3_64(&line[0], line.size(), 17); | ||
if (seen.insert(h).second) | ||
cout << line << '\n'; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters