Skip to content

Commit

Permalink
add more exceptions (close #263)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimus committed Jun 5, 2024
1 parent 42f35e0 commit 26615eb
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 30 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## [v1.10.1] - 2024-06-05 Wed

- Add [#263]: add more exceptions with speciific epithets like
"complex", "do", "spec".

## [v1.10.0] - 2024-06-04 Tue

- Add [#260]: add `candidatus` field for parsed data.
Expand Down
92 changes: 63 additions & 29 deletions ent/internal/preprocess/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,69 @@ var VirusException = map[string]string{
}

var AmbiguousException = map[string][]string{
"Aeolesthes": {"mihi"},
"Agnetina": {"den"},
"Anisochaeta": {"mihi"},
"Antaplaga": {"dela"},
"Baeolidia": {"dela"},
"Bolitoglossa": {"la"},
"Campylosphaera": {"dela"},
"Desmoxytes": {"des"},
"Dicentria": {"dela"},
"Eucyclops": {"mihi"},
"Eulaira": {"dela"},
"Gnathopleustes": {"den"},
"Gobiosoma": {"spec"},
"Helophorus": {"ser"},
"Lampona": {"spec"},
"Leptonetela": {"la"},
"Malamatidia": {"zu"},
"Meteorus": {"dos"},
"Nocaracris": {"van"},
"Paralvinella": {"dela"},
"Ruteloryctes": {"bis"},
"Scoparia": {"dela"},
"Selenops": {"ab"},
"Semiothisa": {"da"},
"Serina": {"ser", "subser"},
"Stenoecia": {"dos"},
"Sympycnus": {"du"},
"Tortolena": {"dela"},
"Zodarion": {"van"},
"Aeolesthes": {"mihi"},
"Agnetina": {"den"},
"Aleuroclava": {"complex"},
"Allawrencius": {"complex"},
"Anisochaeta": {"mihi"},
"Antaplaga": {"dela"},
"Baeolidia": {"dela"},
"Bolbodeomyia": {"complex"},
"Bolitoglossa": {"la"},
"Campylosphaera": {"dela"},
"Castelnaudia": {"spec"},
"Cicada": {"complex"},
"Desmoxytes": {"des"},
"Dicentria": {"dela"},
"Dichostasia": {"complex"},
"Dimorphoceras": {"complex"},
"Dischidia": {"complex"},
"Ecnomus": {"complex"},
"Eucyclops": {"mihi"},
"Eulaira": {"dela"},
"Fusinus": {"complex"},
"Gnathopleustes": {"den"},
"Gobiosoma": {"spec"},
"Gonatobotrys": {"complex"},
"Heizmannia": {"complex"},
"Helophorus": {"ser"},
"Hemicloeina": {"spec"},
"Lampona": {"spec"},
"Leptonetela": {"la"},
"Libystica": {"complex"},
"Malamatidia": {"zu"},
"Meteorus": {"dos"},
"Nocaracris": {"van"},
"Notozomus": {"spec"},
"Ochodaeus": {"complex"},
"Odontella": {"do"},
"Oecetis": {"complex"},
"Oedipina": {"complex"},
"Oedipus": {"complex"},
"Oedopinola": {"complex"},
"Paradimorphoceras": {"complex"},
"Paralvinella": {"dela"},
"Parentia": {"do"},
"Phyllospongia": {"complex"},
"Plectrocnemia": {"complex"},
"Rubus": {"complex"},
"Ruteloryctes": {"bis"},
"Sceliphron": {"complex"},
"Scopaeus": {"complex"},
"Scoparia": {"dela"},
"Selenops": {"ab"},
"Semiothisa": {"da"},
"Serina": {"ser", "subser"},
"Sigipinius": {"complex"},
"Stegosoladidus": {"complex"},
"Stenoecia": {"dos"},
"Sympycnus": {"du"},
"Tetracis": {"complex"},
"Tetramorium": {"do"},
"Tortolena": {"dela"},
"Trichosternus": {"spec"},
"Trisephena": {"complex"},
"Zodarion": {"van"},
}

var NoParseException = map[string]string{
Expand Down
14 changes: 14 additions & 0 deletions gnparser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,20 @@ func TestOutputRestore(t *testing.T) {
assert.Equal(t, "sapiens", sp.Species.Species)
}

func TestExceptions(t *testing.T) {
assert := assert.New(t)
cfg := gnparser.NewConfig()
gnp := gnparser.New(cfg)
f, err := os.Open("testdata/exceptions.txt")
assert.Nil(err)
scanner := bufio.NewScanner(f)
for scanner.Scan() {
name := scanner.Text()
parsed := gnp.ParseName(name)
assert.True(parsed.ParseQuality == 1, name)
}
}

func getTestData(t *testing.T, filename string) []testData {
var res []testData
path := filepath.Join("testdata", filename)
Expand Down
37 changes: 37 additions & 0 deletions testdata/exceptions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Aleuroclava complex Singh, 1931
Allawrencius complex Lawrence, 1953
Bolbodeomyia complex Theobald, 1910
Castelnaudia spec (Darlington, 1962)
Cicada complex Walker, 1850
Dichostasia complex Yochelson, 1956
Dimorphoceras complex (Moore, 1939)
Dischidia complex Griff.
Ecnomus complex Mosely, 1932
Fusinus complex M. A. Snyder, 2000
Fusinus pauciliratus complex M. A. Snyder, 2000
Gonatobotrys complex Jane Walker & Minter
Heizmannia (Heizmannia) complex (Theobald, 1910)
Hemicloeina spec Platnick, 2002
Libystica complex Holland, 1894
Notozomus spec (Harvey, 1992)
Ochodaeus complex LeConte, 1868
Odontella do J Najt, & WM Weiner
Oecetis complex Hwang, 1957
Oedipina complex (Dunn, 1924)
Oedipus complex Dunn, 1924
Oedopinola complex (Dunn, 1924)
Paradimorphoceras complex (Moore, 1939)
Parentia do Bickel, 2002
Phyllospongia complex de Laubenfels, 1954
Plectrocnemia complex Hwang, 1958
Rubus complex L. H. Bailey
Sceliphron complex Kohl, 1918
Sceliphron fossuliferum complex Kohl, 1918
Scopaeus (Scopaeus) complex Sharp, 1874
Scopaeus complex Sharp, 1874
Sigipinius complex Golovatch, 2013
Stegosoladidus complex Berge, 2001
Tetracis complex Sharp, 1874
Tetramorium do Forel, 1914
Trichosternus spec Darlington, 1962
Trisephena complex Medler, 1990
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gnparser
var (
// Version is the version of the gnparser package. When Makefile is
// used, the version is calculated out of Git tags.
Version = "v1.10.0"
Version = "v1.10.1"
// Build is a timestamp of when Makefile was used to compile
// the gnparser code. If go build was used, Build stays empty.
Build string
Expand Down

0 comments on commit 26615eb

Please sign in to comment.