-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use bloom filters for dictionaries (close #115)
- Loading branch information
Showing
18 changed files
with
227 additions
and
23 deletions.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,12 @@ | ||
# bloom script | ||
|
||
This script generates bloom filters that can be used as a smaller and faster | ||
substitution to dictionaries. Bloom filters are generated with this script | ||
are then compiled into the binaries, while dictionaries themselves are | ||
discarded from the final binaries. | ||
|
||
## Usage | ||
|
||
```bash | ||
go run ./... | ||
``` |
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,38 @@ | ||
package main | ||
|
||
import ( | ||
"sync" | ||
|
||
baseBloomfilter "github.com/devopsfaith/bloomfilter/bloomfilter" | ||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
var dataPath = "../../io/dict/data" | ||
var bloomPath = "../../io/dict/bloom" | ||
|
||
type filter struct { | ||
name string | ||
path string | ||
filter *baseBloomfilter.Bloomfilter | ||
size int | ||
mux sync.Mutex | ||
} | ||
|
||
func main() { | ||
log.Info().Msg("Creating bloom filters") | ||
items := []string{ | ||
"bad/uninomials", | ||
"bad/species", | ||
"common/eu", | ||
"ambig/genera", | ||
"ambig/genera_species", | ||
"ambig/species", | ||
"ambig/uninomials", | ||
"good/genera", | ||
"good/species", | ||
"good/uninomials", | ||
} | ||
for _, v := range items { | ||
createFilters(v) | ||
} | ||
} |