Skip to content

Commit 2e153c8

Browse files
committed
compact-authors flag, update docs (close #301)
Rename `--no-spaced-initials` (-N) to `--compact-authors` (-a) for clarity. Remove `--web-logs` flag. Rename `FlatOutput()` method to `WithFlatOutput()`. Update CITATION.cff
1 parent b388cb2 commit 2e153c8

27 files changed

Lines changed: 232 additions & 587 deletions

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
## Unreleased
44

5+
## [v1.14.1] - 2026-01-14 Wed
6+
7+
* Add[#301]: rename 'initials' flag to 'compact-authors'.
8+
**WARNING** this creates backward incompatibility (only for v1.14.0).
9+
* Add: normalize 'flatten' flag.
10+
* Add: remove useless web-log flag.
11+
512
## [v1.14.0] - 2026-01-12 Mon
613

714
* Add[#292]: add flattened option for JSON output, add more (optional) details
@@ -577,6 +584,7 @@
577584

578585
This document follows [changelog guidelines]
579586

587+
[v1.14.1]: https://github.com/gnames/gnparser/compare/v1.14.0...v1.14.1
580588
[v1.14.0]: https://github.com/gnames/gnparser/compare/v1.13.0...v1.14.0
581589
[v1.13.0]: https://github.com/gnames/gnparser/compare/v1.12.1...v1.13.0
582590
[v1.12.1]: https://github.com/gnames/gnparser/compare/v1.12.0...v1.12.1
@@ -668,6 +676,16 @@ This document follows [changelog guidelines]
668676
[v0.7.0]: https://github.com/gnames/gnparser/compare/v0.6.0...v0.7.0
669677
[v0.6.0]: https://github.com/gnames/gnparser/compare/v0.5.1...v0.6.0
670678
[v0.5.1]: https://github.com/gnames/gnparser/tree/v0.5.1
679+
[#310]: https://github.com/gnames/gnparser/issues/310
680+
[#309]: https://github.com/gnames/gnparser/issues/309
681+
[#308]: https://github.com/gnames/gnparser/issues/308
682+
[#307]: https://github.com/gnames/gnparser/issues/307
683+
[#306]: https://github.com/gnames/gnparser/issues/306
684+
[#305]: https://github.com/gnames/gnparser/issues/305
685+
[#304]: https://github.com/gnames/gnparser/issues/304
686+
[#303]: https://github.com/gnames/gnparser/issues/303
687+
[#302]: https://github.com/gnames/gnparser/issues/302
688+
[#301]: https://github.com/gnames/gnparser/issues/301
671689
[#300]: https://github.com/gnames/gnparser/issues/300
672690
[#299]: https://github.com/gnames/gnparser/issues/299
673691
[#298]: https://github.com/gnames/gnparser/issues/298

CITATION.cff

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
cff-version: 1.2.0
22
message: "If you use this software, please cite it as below."
33
title: "GNparser -- a powerful scientific names parser."
4-
version: v1.11.1
4+
version: v1.14.1
55
authors:
66
- family-names: "Mozzherin"
77
given-names: "Dmitry"
88
orcid: "https://orcid.org/0000-0003-1593-1417"
99
- family-names: "Marsden"
1010
given-names: "Toby"
11+
- family-names: "Ower"
12+
given-names: "Geoffrey"
13+
orcid: "https://orcid.org/0000-0002-9770-2345"
14+
- family-names: "Juillerat"
15+
given-names: "Philippe"
16+
orcid: "https://orcid.org/0000-0002-5464-777X"
1117
- family-names: "Pereira"
1218
given-names: "Hernán Lucas"
1319
orcid: "https://orcid.org/0000-0001-6681-7038"
1420
repository-code: "https://github.com/gnames/gnparser"
15-
doi: 10.5281/zenodo.14096467
16-
date-released: 2024-11-07
21+
doi: 10.5281/zenodo.18221581
22+
date-released: 2026-01-14
1723
license: MIT

README.md

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Global Names Parser: GNparser written in Go
22

3-
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18002432.svg)](https://doi.org/10.5281/zenodo.18002432)
3+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18221581.svg)](https://doi.org/10.5281/zenodo.18221581)
44

55
Try `GNparser` [online][parser-web].
66

@@ -67,7 +67,6 @@ gnparser -h
6767
* [Ruby Gem](#ruby-gem)
6868
* [Node.js](#nodejs)
6969
* [Usage as a REST API Interface or Web-based User Graphical Interface](#usage-as-a-rest-api-interface-or-web-based-user-graphical-interface)
70-
* [Enabling logs for GNparser's web-service](#enabling-logs-for-gnparsers-web-service)
7170
* [Use as a Docker image](#use-as-a-docker-image)
7271
* [Use as a library in Go](#use-as-a-library-in-go)
7372
* [Use as a shared C library](#use-as-a-shared-c-library)
@@ -416,10 +415,11 @@ formats (CSV/TSV formats are always flattened). Instead of nested objects like
416415
the output easier to process in some applications. Some detailed information
417416
would be lost in the flattened format.
418417

419-
`--no-spaced-initials -N`
418+
`--compact-authors -a`
420419
: Removes space between authors' initials, e.g.
421420
`Schoenoplectus tabernaemontani (C. C. Gmel.) Palla`. The normalized
422-
authorship will be generated without space between initials.
421+
authorship will be generated without space between initials
422+
`Schoenoplectus tabernaemontani (C.C.Gmel.) Palla`.
423423

424424
`--format -f`
425425
: Specifies the output format: `csv`, `tsv`, `compact`, or `pretty`.
@@ -461,9 +461,6 @@ Useful for integrating gnparser with languages other than Go.
461461
`--version -V`
462462
: Displays the version number of `GNparser`.
463463

464-
`--web-logs`
465-
: Requires `--port`. Enables output of logs for web-services.
466-
467464
To parse one name:
468465

469466
```bash
@@ -613,24 +610,14 @@ request.body = ['Solanum mariae Särkinen & S.Knapp',
613610
response = http.request(request)
614611
```
615612

616-
#### Enabling logs for GNparser's web-service
617-
618-
There are several ways to enable logging from a web service.
619-
620-
The following enables web-access logs to be printed to STDERR
621-
622-
```bash
623-
gnparser -p 80 --web-logs
624-
```
625-
626613
### Use as a Docker image
627614

628615
You need to have [docker runtime installed][docker-install]
629616
on your computer for these examples to work.
630617

631618
```bash
632619
# run as a website and a RESTful service
633-
docker run -p 0.0.0.0:80:8080 gnames/gognparser -p 8080 --web-logs
620+
docker run -p 0.0.0.0:80:8080 gnames/gognparser -p 8080
634621

635622
# just parse something
636623
docker run gnames/gognparser "Amaurorhinus bewichianus (Wollaston,1860) (s.str.)"
@@ -717,6 +704,7 @@ and Subrealm. We try to detect such names and place them in an exception list.
717704
## Contributors
718705

719706
* [Toby Marsden]
707+
* [Geoffrey Ower]
720708
* [Philippe Juillerat]
721709
* [Hernan Lucas Pereira]
722710

@@ -748,6 +736,7 @@ Released under [MIT license]
748736

749737
[CONTRIBUTING]: CONTRIBUTING.md
750738
[Dmitry Mozzherin]: https://github.com/dimus
739+
[Geoffrey Ower]: https://github.com/gdower
751740
[Hernan Lucas Pereira]: https://github.com/LocoDelAssembly
752741
[Homebrew]: https://brew.sh/
753742
[IRMNG]: http://www.irmng.org

binding/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func ParseToString(
3030
codeStr *C.char,
3131
details C.int,
3232
diaereses C.int,
33-
noSpacedInitials C.int,
33+
compactAuthors C.int,
3434
flatten C.int,
3535
) *C.char {
3636
goname := C.GoString(name)
@@ -44,12 +44,12 @@ func ParseToString(
4444
gnparser.OptWithDetails(int(details) > 0),
4545
gnparser.OptCode(code),
4646
gnparser.OptWithPreserveDiaereses(int(diaereses) > 0),
47-
gnparser.OptWithNoSpacedInitials(int(noSpacedInitials) > 0),
47+
gnparser.OptWithCompactAuthors(int(compactAuthors) > 0),
4848
gnparser.OptWithFlatOutput(int(flatten) > 0),
4949
}
5050
cfg := gnparser.NewConfig(opts...)
5151
gnp := gnparser.New(cfg)
52-
parsed := gnp.ParseName(goname).Output(gnp.Format(), gnp.FlatOutput())
52+
parsed := gnp.ParseName(goname).Output(gnp.Format(), gnp.WithFlatOutput())
5353

5454
return C.CString(parsed)
5555
}
@@ -75,7 +75,7 @@ func ParseAryToString(
7575
codeStr *C.char,
7676
details C.int,
7777
diaereses C.int,
78-
noSpacedInitials C.int,
78+
compactAuthors C.int,
7979
flatten C.int,
8080
) *C.char {
8181
names := make([]string, int(length))
@@ -90,7 +90,7 @@ func ParseAryToString(
9090
gnparser.OptWithDetails(int(details) > 0),
9191
gnparser.OptCode(code),
9292
gnparser.OptWithPreserveDiaereses(int(diaereses) > 0),
93-
gnparser.OptWithNoSpacedInitials(int(noSpacedInitials) > 0),
93+
gnparser.OptWithCompactAuthors(int(compactAuthors) > 0),
9494
gnparser.OptWithFlatOutput(int(flatten) > 0),
9595
}
9696
start := unsafe.Pointer(in)
@@ -111,7 +111,7 @@ func ParseAryToString(
111111
if gnp.Format() == gnfmt.CSV {
112112
csv := make([]string, length)
113113
for i := range parsed {
114-
csv[i] = parsed[i].Output(gnfmt.CSV, gnp.FlatOutput())
114+
csv[i] = parsed[i].Output(gnfmt.CSV, gnp.WithFlatOutput())
115115
}
116116
res = strings.Join(csv, "\n")
117117
} else {

config.go

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ type Config struct {
5959
// WithPreserveDiaereses flag, when true, diaereses will not be transliterated
6060
WithPreserveDiaereses bool
6161

62-
// WithNoSpacedInitials flag, when true, authors' initials will not be
62+
// WithCompactAuthors flag, when true, authors' initials will not be
6363
// separated by space
64-
WithNoSpacedInitials bool
64+
WithCompactAuthors bool
6565

6666
// WithFlatOutput flag, when true, JSON output is converted from nested
6767
// structure to a flat one. It simplifies the output usage, but looses
@@ -72,10 +72,6 @@ type Config struct {
7272
// at a time. When WithStream is true, BatchSize setting is ignored.
7373
WithStream bool
7474

75-
// WithWebLogs flag enables logs when running web-service. This flag is
76-
// ignored if `Port` value is not set.
77-
WithWebLogs bool
78-
7975
// WithSpeciesGroupCut flag means that stemmed version of autonyms (ICN) and
8076
// species group names (ICZN) will be truncated to species. It helps to
8177
// simplify matching names like `Aus bus` and `Aus bus bus`.
@@ -177,10 +173,10 @@ func OptWithPreserveDiaereses(b bool) Option {
177173
}
178174
}
179175

180-
// OptWithNoSpacedInitials sets the NoSpacedInitials field.
181-
func OptWithNoSpacedInitials(b bool) Option {
176+
// OptWithCompactAuthors sets the WithCompactAuthors field.
177+
func OptWithCompactAuthors(b bool) Option {
182178
return func(cfg *Config) {
183-
cfg.WithNoSpacedInitials = b
179+
cfg.WithCompactAuthors = b
184180
}
185181
}
186182

@@ -198,13 +194,6 @@ func OptWithStream(b bool) Option {
198194
}
199195
}
200196

201-
// OptWithWebLogs sets the WithWebLogs field.
202-
func OptWithWebLogs(b bool) Option {
203-
return func(cfg *Config) {
204-
cfg.WithWebLogs = b
205-
}
206-
}
207-
208197
// OptWithSpeciesGroupCut sets WithSpeciesGroupCut field.
209198
func OptWithSpeciesGroupCut(b bool) Option {
210199
return func(cfg *Config) {

default.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
}:
88
buildGoModule rec {
99
pname = "gnparser";
10-
version = "v1.14.0";
11-
date = "2026-01-12";
10+
version = "v1.14.1";
11+
date = "2026-01-14";
1212

1313
src = lib.cleanSourceWith {
1414
filter = name: type: let
@@ -18,7 +18,7 @@ buildGoModule rec {
1818
src = lib.cleanSource ./.;
1919
};
2020

21-
vendorHash = "sha256-NdD9rLZ5pX4M/4OD2zrN42HG+HtH49d1d+yXuLPtn7w=";
21+
vendorHash = "sha256-Oitse5Te35Cs8Ub7ueDw60JM5p8FOsyMsZif8OQQ+uE=";
2222

2323
buildInputs = [
2424
stdenv

ent/parser/ast.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ func (p *Engine) newAuthorNode(n *node32) *authorNode {
11651165
val := ""
11661166
rawVal := ""
11671167
var sep string
1168-
if !p.noSpacedInitials {
1168+
if !p.compactAuthors {
11691169
sep = " "
11701170
}
11711171
n = n.up

ent/parser/engine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type baseEngine struct {
2727
tail string
2828
cultivar bool
2929
preserveDiaereses bool
30-
noSpacedInitials bool
30+
compactAuthors bool
3131
}
3232

3333
// New creates implementation of Parser interface.

ent/parser/interfaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Parser interface {
1313
PreprocessAndParse(
1414
name, version string,
1515
code nomcode.Code,
16-
keepHTML, capitalize, preserveDiaereses, noSpacedInitials bool,
16+
keepHTML, capitalize, preserveDiaereses, compactAuthors bool,
1717
) ScientificNameNode
1818
Debug(name string) []byte
1919
}

ent/parser/parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ func (p *Engine) PreprocessAndParse(
4444
keepHTML bool,
4545
capitalize bool,
4646
preserveDiaereses bool,
47-
noSpacedInitials bool,
47+
compactAuthors bool,
4848
) ScientificNameNode {
4949
p.code = code
5050
p.preserveDiaereses = preserveDiaereses
51-
p.noSpacedInitials = noSpacedInitials
51+
p.compactAuthors = compactAuthors
5252

5353
originalString := s
5454
var tagsOrEntities, lowCase bool

0 commit comments

Comments
 (0)