Skip to content

Commit

Permalink
add score details (close #23)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimus committed May 11, 2022
1 parent de6e756 commit 08d8dcd
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 80 deletions.
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@

## Unreleased

## [v0.2.0]
## [v0.2.1] - 2022-05-11 Wed

- Add [#23]: score details in results.

## [v0.2.0] - 2022-04-25 Mon

- Add [#21]: more parsed information in JSON output.
- Add [#20]: take ranks in account during matching.
- Add [#17]: sort results according to their score.
- Add [#10]: show csv/tsv header in the output.
- Fix [#16]: empty Family and ID do not create false fields.

## [v0.1.1]
## [v0.1.1] - 2021-12-27 Mon

- Add [#9]: allow to take TSV files and simple names lists.

## [v0.1.0]
## [v0.1.0] - 2021-12-27 Mon

- Add [#8]: make command line application.
- Add [#7]: compare two checklists.
Expand All @@ -29,6 +33,7 @@

This document follows [changelog guidelines]

[v0.2.1]: https://github.com/gnames/gndiff/compare/v0.2.0...v0.2.1
[v0.2.0]: https://github.com/gnames/gndiff/compare/v0.1.1...v0.2.0
[v0.1.1]: https://github.com/gnames/gndiff/compare/v0.1.0...v0.1.1
[v0.1.0]: https://github.com/gnames/gndiff/tree/v0.1.0
Expand Down
31 changes: 16 additions & 15 deletions ent/record/record.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
package record

import (
"github.com/gnames/gnlib/ent/verifier"
vlib "github.com/gnames/gnlib/ent/verifier"
"github.com/gnames/gnparser/ent/parsed"
)

type Record struct {
DataSet string `json:"dataSet"`
Index int `json:"index"`
EditDistance int `json:"editDistance,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name"`
ParsingQuality int `json:"parsingQuality"`
Cardinality int `json:"cardinality,omitempty"`
CanonicalSimple string `json:"canonicalSimple,omitempty"`
CanonicalFull string `json:"canonicalFull,omitempty"`
Authors []string `json:"authors,omitempty"`
Year int `json:"year,omitempty"`
Family string `json:"family,omitempty"`
MatchType verifier.MatchTypeValue `json:"matchType,omitempty"`
Score float64 `json:"score,omitempty"`
DataSet string `json:"dataSet"`
Index int `json:"index"`
EditDistance int `json:"editDistance,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name"`
ParsingQuality int `json:"parsingQuality"`
Cardinality int `json:"cardinality,omitempty"`
CanonicalSimple string `json:"canonicalSimple,omitempty"`
CanonicalFull string `json:"canonicalFull,omitempty"`
Authors []string `json:"authors,omitempty"`
Year int `json:"year,omitempty"`
Family string `json:"family,omitempty"`
MatchType vlib.MatchTypeValue `json:"matchType,omitempty"`
Score float64 `json:"score,omitempty"`
ScoreDetails *vlib.ScoreDetails `json:"scoreDetails,omitempty"`
parsed.Parsed `json:"-"`
}
3 changes: 2 additions & 1 deletion gndiff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

var path = "testdata/"

// Issue #17
// Issue #17: sorting data according to the score.
func TestScore(t *testing.T) {
assert := assert.New(t)
cfg := config.New()
Expand All @@ -35,6 +35,7 @@ func TestScore(t *testing.T) {
bubo := res.Matches[2]

assert.Equal("Obione maritima var. maritimaa", obione.ReferenceRecords[0].CanonicalFull)
assert.NotNil(obione.ReferenceRecords[0].ScoreDetails)
assert.Equal("Bubo bubo Linn. 1758", bubo.ReferenceRecords[0].Name)
assert.Equal("Abelia forrestii var. gracilenta (W.W.Sm.) Landrein", abelia.ReferenceRecords[0].Name)
}
Expand Down
55 changes: 29 additions & 26 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,66 +6,69 @@ require (
github.com/devopsfaith/bloomfilter v1.4.0
github.com/dgraph-io/badger/v2 v2.2007.4
github.com/dvirsky/levenshtein v0.0.0-20200624034316-59b26b61c3c8
github.com/gnames/gnames v0.13.0
github.com/gnames/gnames v1.0.0-RC1
github.com/gnames/gnfmt v0.2.0
github.com/gnames/gnlib v0.13.0
github.com/gnames/gnlib v0.14.0
github.com/gnames/gnparser v1.6.5
github.com/gnames/gnsys v0.2.2
github.com/gnames/levenshtein v0.2.1
github.com/sirupsen/logrus v1.7.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.4.0
github.com/spf13/viper v1.10.1
github.com/spf13/viper v1.11.0
github.com/stretchr/testify v1.7.1
golang.org/x/perf v0.0.0-20220317191433-96728ec1d780
golang.org/x/perf v0.0.0-20220411212318-84e58bfe0a7e
golang.org/x/tools v0.1.10
)

require (
github.com/Shugyousha/mafsa v0.2.0 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de // indirect
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gnames/gnstats v0.1.0 // indirect
github.com/gnames/gnuuid v0.1.1 // indirect
github.com/gnames/organizer v0.1.1 // indirect
github.com/gnames/tribool v0.1.1 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/klauspost/compress v1.15.4 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/zerolog v1.26.1 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tmthrgd/atomics v0.0.0-20180217065130-6910de195248 // indirect
github.com/tmthrgd/go-bitset v0.0.0-20180828125936-62ad9ed7ff29 // indirect
github.com/tmthrgd/go-bitwise v0.0.0-20170218093117-01bef038b6bd // indirect
github.com/tmthrgd/go-byte-test v0.0.0-20170223110042-2eb5216b83f7 // indirect
github.com/tmthrgd/go-hex v0.0.0-20180828131331-d1fb3dbb16a1 // indirect
github.com/tmthrgd/go-memset v0.0.0-20180828131805-6f4e59bf1e1d // indirect
github.com/tmthrgd/go-popcount v0.0.0-20180111143836-3918361d3e97 // indirect
github.com/tmthrgd/atomics v0.0.0-20190904060638-dc7a5fcc7e0d // indirect
github.com/tmthrgd/go-bitset v0.0.0-20190904054048-394d9a556c05 // indirect
github.com/tmthrgd/go-bitwise v0.0.0-20190904053232-1430ee983fca // indirect
github.com/tmthrgd/go-byte-test v0.0.0-20190904060354-2794345b9929 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/tmthrgd/go-memset v0.0.0-20190904060434-6fb7a21f88f1 // indirect
github.com/tmthrgd/go-popcount v0.0.0-20190904054823-afb1ace8b04f // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit 08d8dcd

Please sign in to comment.