diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-03-30 01:35:58 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-03-30 01:35:58 +0200 |
commit | e8ed1ff2a60b694b242669a50c5a37346f3b6d79 (patch) | |
tree | 28eeed2962722ff9c63cb7db80cf559b68fd3b97 /skate/cmd | |
parent | 956476225837ad9ccf30c9698806e3fd959b75ef (diff) | |
download | refcat-e8ed1ff2a60b694b242669a50c5a37346f3b6d79.tar.gz refcat-e8ed1ff2a60b694b242669a50c5a37346f3b6d79.zip |
stub wikipedia converter
Diffstat (limited to 'skate/cmd')
-rw-r--r-- | skate/cmd/skate-biblioref-from-wikipedia/main.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/skate/cmd/skate-biblioref-from-wikipedia/main.go b/skate/cmd/skate-biblioref-from-wikipedia/main.go new file mode 100644 index 0000000..552b625 --- /dev/null +++ b/skate/cmd/skate-biblioref-from-wikipedia/main.go @@ -0,0 +1,35 @@ +package main + +import ( + "flag" + "log" + "os" + "runtime" + + "git.archive.org/martin/cgraph/skate" + "git.archive.org/martin/cgraph/skate/parallel" + jsoniter "github.com/json-iterator/go" +) + +var ( + numWorkers = flag.Int("w", runtime.NumCPU(), "number of workers") + batchSize = flag.Int("b", 100000, "batch size") + json = jsoniter.ConfigCompatibleWithStandardLibrary + bytesNewline = []byte("\n") +) + +func main() { + flag.Parse() + pp := parallel.NewProcessor(os.Stdin, os.Stdout, func(p []byte) ([]byte, error) { + var w skate.MinimalCitations + if err := json.Unmarshal(p, &w); err != nil { + return nil, err + } + return nil, nil + }) + pp.NumWorkers = *numWorkers + pp.BatchSize = *batchSize + if err := pp.Run(); err != nil { + log.Fatal(err) + } +} |