aboutsummaryrefslogtreecommitdiffstats
path: root/skate/zippy.go
diff options
context:
space:
mode:
Diffstat (limited to 'skate/zippy.go')
-rw-r--r--skate/zippy.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/skate/zippy.go b/skate/zippy.go
index 6b1c373..c8d2aee 100644
--- a/skate/zippy.go
+++ b/skate/zippy.go
@@ -11,12 +11,12 @@ import (
// This file contains the two-stream (zippy) matchers.
-// ZippyFixed takes a release and refs reader (tsv, with ident, key, doc)
+// ZippyExact takes a release and refs reader (tsv, with ident, key, doc)
// and assigns a fixed match result.
-func ZippyFixed(releases, refs io.Reader, mr MatchResult, provenance string, w io.Writer) error {
+func ZippyExact(releases, refs io.Reader, matchResult MatchResult, w io.Writer) error {
var (
enc = json.NewEncoder(w)
- keyer = makeKeyFunc("\t", 2)
+ keyer = makeKeyFunc("\t", 1)
grouper = func(g *zipkey.Group) error {
var (
target *Release
@@ -26,11 +26,11 @@ func ZippyFixed(releases, refs io.Reader, mr MatchResult, provenance string, w i
if len(g.G0) == 0 || len(g.G1) == 0 {
return nil
}
- if target, err = stringToRelease(cut(g.G0[0], "\t", 3)); err != nil {
+ if target, err = stringToRelease(cut(g.G0[0], "\t", 2)); err != nil {
return err
}
for _, line := range g.G1 {
- if ref, err = stringToRef(cut(line, "\t", 3)); err != nil {
+ if ref, err = stringToRef(cut(line, "\t", 2)); err != nil {
return err
}
var bref BiblioRef
@@ -42,9 +42,9 @@ func ZippyFixed(releases, refs io.Reader, mr MatchResult, provenance string, w i
bref.RefKey = ref.Key
bref.TargetReleaseIdent = target.Ident
bref.TargetWorkIdent = target.WorkID
- bref.MatchProvenance = provenance
- bref.MatchStatus = mr.Status.Short()
- bref.MatchReason = mr.Reason.Short()
+ bref.MatchProvenance = ref.RefSource
+ bref.MatchStatus = matchResult.Status.Short()
+ bref.MatchReason = matchResult.Reason.Short()
if err := enc.Encode(bref); err != nil {
return err
}
@@ -56,12 +56,12 @@ func ZippyFixed(releases, refs io.Reader, mr MatchResult, provenance string, w i
return zipper.Run()
}
-// ZippyFixedWiki takes a release and wiki reader (tsv, with ident, key, doc)
+// ZippyExactWiki takes a release and wiki reader (tsv, with key, doc)
// and assigns a fixed match result.
-func ZippyFixedWiki(releases, wiki io.Reader, mr MatchResult, provenance string, w io.Writer) error {
+func ZippyExactWiki(releases, wiki io.Reader, mr MatchResult, w io.Writer) error {
var (
enc = json.NewEncoder(w)
- keyer = makeKeyFunc("\t", 2)
+ keyer = makeKeyFunc("\t", 1)
grouper = func(g *zipkey.Group) error {
var (
target *Release
@@ -71,11 +71,11 @@ func ZippyFixedWiki(releases, wiki io.Reader, mr MatchResult, provenance string,
if len(g.G0) == 0 || len(g.G1) == 0 {
return nil
}
- if target, err = stringToRelease(cut(g.G0[0], "\t", 3)); err != nil {
+ if target, err = stringToRelease(cut(g.G0[0], "\t", 2)); err != nil {
return err
}
for _, line := range g.G1 {
- if wiki, err = stringToWiki(cut(line, "\t", 3)); err != nil {
+ if wiki, err = stringToWiki(cut(line, "\t", 2)); err != nil {
return err
}
var bref BiblioRef
@@ -83,7 +83,7 @@ func ZippyFixedWiki(releases, wiki io.Reader, mr MatchResult, provenance string,
bref.SourceWikipediaArticle = wiki.PageTitle
bref.TargetReleaseIdent = target.Ident
bref.TargetWorkIdent = target.WorkID
- bref.MatchProvenance = provenance
+ bref.MatchProvenance = "wikipedia"
bref.MatchStatus = mr.Status.Short()
bref.MatchReason = mr.Reason.Short()
if err := enc.Encode(bref); err != nil {