Skip to content

Commit

Permalink
Add build script for cbor file generation for color names dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
blenderskool committed Sep 3, 2020
1 parent a0a6fc9 commit 3c3e398
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
**/*.rs.bk
pkg
pkg
*.cbor
23 changes: 21 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ termion = "1.5.5"
prettytable-rs = "0.8.0"
pigmnts = { path = "lib" }
reqwest = { version = "0.10", features = ["blocking"] }
serde_cbor = "0.11.1"
lazy_static = "^1.4.0"

[build-dependencies]
serde_json = "^1.0.52"
serde_cbor = "^0.11.1"

[[bin]]
name = "pigmnts"
Expand Down
13 changes: 13 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extern crate serde_cbor;
extern crate serde_json;

use std::fs::File;

fn main() {
// This dataset has been taken from https://github.com/meodai/color-names
let color_names_file = File::open("./data/colornames.bestof.min.json").unwrap();
let color_names: serde_json::Value = serde_json::from_reader(color_names_file).unwrap();

let dest_file = File::create("./data/colornames.cbor").unwrap();
serde_cbor::to_writer(dest_file, &color_names).unwrap();
}
1 change: 1 addition & 0 deletions data/colornames.bestof.min.json

Large diffs are not rendered by default.

0 comments on commit 3c3e398

Please sign in to comment.