aboutsummaryrefslogtreecommitdiffstats
path: root/skate/cmd/skate-verify/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'skate/cmd/skate-verify/main.go')
-rw-r--r--skate/cmd/skate-verify/main.go27
1 files changed, 24 insertions, 3 deletions
diff --git a/skate/cmd/skate-verify/main.go b/skate/cmd/skate-verify/main.go
index e6fc417..e59d263 100644
--- a/skate/cmd/skate-verify/main.go
+++ b/skate/cmd/skate-verify/main.go
@@ -16,17 +16,18 @@ import (
"runtime/pprof"
"strings"
- jsoniter "github.com/json-iterator/go"
"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", 10000, "batch size")
- mode = flag.String("m", "ref", "mode: exact, ref, bref, zip, bzip")
+ mode = flag.String("m", "ref", "mode: exact, ref, bref, zip, bzip, wiki")
exactReason = flag.String("r", "", "doi, pmid, pmcid, arxiv")
provenance = flag.String("p", "join", "provenance info")
+ wikiFile = flag.String("W", "", "wiki citation file")
releasesFile = flag.String("R", "", "releases, tsv, sorted by key (zip mode only)")
refsFile = flag.String("F", "", "refs, tsv, sorted by key (zip mode only)")
cpuProfile = flag.String("cpuprofile", "", "write cpu profile to file")
@@ -90,7 +91,7 @@ func main() {
// Take two "sorted key files" (one refs, one releases) and run
// verification across groups, generate biblioref file.
if *refsFile == "" || *releasesFile == "" {
- log.Fatal("zip mode requires -R and -F to be set")
+ log.Fatal("zip mode requires -F and -R to be set")
}
f, err := os.Open(*releasesFile)
if err != nil {
@@ -123,6 +124,26 @@ func main() {
if err := pp.Run(); err != nil {
log.Fatal(err)
}
+ case "wiki":
+ // Fixed zip mode for DOI from wikipedia.
+ if *wikiFile == "" || *releasesFile == "" {
+ log.Fatal("mode requires -W and -F to be set")
+ }
+ f, err := os.Open(*releasesFile)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer f.Close()
+ g, err := os.Open(*wikiFile)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer g.Close()
+ bw := bufio.NewWriter(os.Stdout)
+ defer bw.Flush()
+ if err := skate.ZipUnverified(f, g, skate.MatchResult{skate.StatusExact, skate.ReasonDOI}, "wiki", bw); err != nil {
+ log.Fatal(err)
+ }
default:
log.Fatal("not implemented, only: zip, ref, bref")
}