aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--skate/zippy.go21
1 files changed, 9 insertions, 12 deletions
diff --git a/skate/zippy.go b/skate/zippy.go
index 8e629bf..6034351 100644
--- a/skate/zippy.go
+++ b/skate/zippy.go
@@ -1,5 +1,7 @@
-// This file contains various "reducers", e.g. functions, that take two data
-// streams and will apply a computation on matched groups.
+// This file contains various "reducers", e.g. working on two data streams and
+// applying a function on groups of documents with a shared key.
+//
+// Note: A bit repetitive, but not want to introduce any other abstraction.
package skate
import (
@@ -20,7 +22,7 @@ func groupLogf(g *zipkey.Group, s string, vs ...interface{}) {
}
// ZippyExact takes a release and refs reader (key, doc) and assigns a fixed
-// match result. XXX: allow empty keys
+// match result.
func ZippyExact(releases, refs io.Reader, matchResult MatchResult, w io.Writer) error {
var (
enc = json.NewEncoder(w)
@@ -112,12 +114,9 @@ func ZippyExactWiki(releases, wiki io.Reader, mr MatchResult, w io.Writer) error
return zipper.Run()
}
-// ZippyVerifyRefs takes a release and refs reader (tsv, with ident, key, doc)
-// and will execute gf for each group found.
+// ZippyVerifyRefs takes a release and refs reader (key, doc), run fuzzy
+// verification and will emit a biblioref document, if exact or strong match.
func ZippyVerifyRefs(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.
var (
enc = json.NewEncoder(w)
keyer = makeKeyFunc("\t", 1)
@@ -160,10 +159,8 @@ func ZippyVerifyRefs(releases, refs io.Reader, w io.Writer) error {
}
// ZippyVerifyRefsOpenLibraryTable takes OL editions (as release) and refs (as
-// release) and emits biblioref.
+// release) and emits a match table for manual inspection.
func ZippyVerifyRefsOpenLibraryTable(olr, 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.
var (
keyer = makeKeyFunc("\t", 1)
grouper = func(g *zipkey.Group) error {
@@ -174,7 +171,7 @@ func ZippyVerifyRefsOpenLibraryTable(olr, refs io.Reader, w io.Writer) error {
if len(g.G0) == 0 || len(g.G1) == 0 {
return nil
}
- // We take a single edition from OL; XXX: might want to link to work.
+ // We take a single edition from OL.
if pivot, err = stringToRelease(Cut(g.G0[0], 2)); err != nil {
return err
}