aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-05-27 02:51:55 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-05-27 02:51:55 +0200
commitbba89d100b21eba99d9aacc4091a362f6931f773 (patch)
tree28523349151de7aa13864bd95f1f6b7580bb8527
parent6749a85c609175ba46afe965488d59f250ca63b6 (diff)
downloadrefcat-bba89d100b21eba99d9aacc4091a362f6931f773.tar.gz
refcat-bba89d100b21eba99d9aacc4091a362f6931f773.zip
reduce: tweak output
-rw-r--r--skate/cmd/skate-reduce/main.go2
-rw-r--r--skate/zippy.go36
2 files changed, 11 insertions, 27 deletions
diff --git a/skate/cmd/skate-reduce/main.go b/skate/cmd/skate-reduce/main.go
index 84e87d9..3cd15c8 100644
--- a/skate/cmd/skate-reduce/main.go
+++ b/skate/cmd/skate-reduce/main.go
@@ -143,7 +143,7 @@ func main() {
log.Fatal(err)
}
// XXX: This is broken.
- if err := skate.ZippyVerifyRefs(o, f, bw); err != nil {
+ if err := skate.ZippyVerifyRefsOnly(o, f, bw); err != nil {
log.Fatal(err)
}
default:
diff --git a/skate/zippy.go b/skate/zippy.go
index 1da280c..5c70902 100644
--- a/skate/zippy.go
+++ b/skate/zippy.go
@@ -159,14 +159,12 @@ func ZippyVerifyRefs(releases, refs io.Reader, w io.Writer) error {
return zipper.Run()
}
-// ZippyRefsOpenLibrary takes a release and refs reader (tsv, with ident, key, doc)
+// ZippyVerifyRefsOnly takes a release and refs reader (tsv, with ident, key, doc)
// and will execute gf for each group found.
-func ZippyRefsOpenLibrary(olr, refs io.Reader, w io.Writer) error {
+func ZippyVerifyRefsOnly(releases, refs io.Reader, w io.Writer) error {
// Define a grouper, working on one set of refs and releases with the same
- // key at a time. Here, we do verification and write out the generated
- // biblioref.
+ // key at a time.
var (
- enc = json.NewEncoder(w)
keyer = makeKeyFunc("\t", 1)
grouper = func(g *zipkey.Group) error {
var (
@@ -184,34 +182,20 @@ func ZippyRefsOpenLibrary(olr, refs io.Reader, w io.Writer) error {
return err
}
result := Verify(pivot, re)
- switch result.Status {
- case StatusExact, StatusStrong:
- if result.Reason == ReasonDOI {
- continue
- }
- br := generateBiblioRef(re, pivot, result, "fuzzy")
- if err := enc.Encode(br); err != nil {
- return err
- }
- default:
- // XXX: We want to add unmatched pieces as well; here? We
- // probably want to do a single final pass to complete the
- // dataset.
- }
+ fmt.Printf("%s\t%s\t%s\t%s\t%s\n",
+ result.Status.Short(),
+ result.Reason.Short(),
+ cut(g.G0[0], "\t", 1),
+ pivot.Title,
+ re.Title)
}
return nil
}
)
- zipper := zipkey.New(olr, refs, keyer, grouper)
+ zipper := zipkey.New(releases, refs, keyer, grouper)
return zipper.Run()
}
-func ZippyOpenLibraryMerge(ole, olw io.Reader, w io.Writer) error {
- // XXX: augment on or the other schema with subtitles; maybe generate
- // release schema right away.
- return nil
-}
-
// makeKeyFunc creates a function that can be used as keyFunc, selecting a
// column from fields separated by sep; column is 1-indexed.
func makeKeyFunc(sep string, column int) func(string) (string, error) {