Skip to content

Commit

Permalink
Support graft-chimeras
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymarsden committed Oct 21, 2021
1 parent f89183e commit 5935f18
Show file tree
Hide file tree
Showing 14 changed files with 5,205 additions and 4,581 deletions.
28 changes: 18 additions & 10 deletions ent/parsed/annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,32 @@ const (
BOLDAnnot
// HybridAnnot is a miscellaneous hybrid name.
HybridAnnot
// NameHybridAnnot is a stable hybrid in botany with registered name.
// NamedHybridAnnot is a stable hybrid in botany with registered name.
NamedHybridAnnot
// HybridFormulaAnnot is a hybrid created by combination of 2 or more names.
HybridFormulaAnnot
// NothoHybridAnnot is a hybrid with notho- 'ranks'.
NothoHybridAnnot
// GraftChimeraAnnot is a miscellaneous graft-chimera name.
GraftChimeraAnnot
// GraftChimeraFormulatAnnot is a graft-chimera created by the combination of 2 or more names
GraftChimeraFormulaAnnot
// NamedGraftChimeraAnnot is a stable graft-chimera in botany with registered name.
NamedGraftChimeraAnnot
)

var annotMap = map[Annotation]string{
NoAnnot: "",
SurrogateAnnot: "SURROGATE",
ComparisonAnnot: "COMPARISON",
ApproximationAnnot: "APPROXIMATION",
BOLDAnnot: "BOLD_SURROGATE",
HybridAnnot: "HYBRID",
NamedHybridAnnot: "NAMED_HYBRID",
HybridFormulaAnnot: "HYBRID_FORMULA",
NothoHybridAnnot: "NOTHO_HYBRID",
NoAnnot: "",
SurrogateAnnot: "SURROGATE",
ComparisonAnnot: "COMPARISON",
ApproximationAnnot: "APPROXIMATION",
BOLDAnnot: "BOLD_SURROGATE",
HybridAnnot: "HYBRID",
NamedHybridAnnot: "NAMED_HYBRID",
HybridFormulaAnnot: "HYBRID_FORMULA",
NothoHybridAnnot: "NOTHO_HYBRID",
GraftChimeraFormulaAnnot: "GRAFT_CHIMERA_FORMULA",
NamedGraftChimeraAnnot: "NAMED_GRAFT_CHIMERA",
}

var annotStrMap = func() map[string]Annotation {
Expand Down
9 changes: 9 additions & 0 deletions ent/parsed/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,18 @@ type DetailsHybridFormula struct {
HybridFormula []Details `json:"hybridFormula"`
}

// DetailsGraftChimeraFormula are details for a graft-chimera formula names.
type DetailsGraftChimeraFormula struct {
GraftChimeraFormula []Details `json:"graftChimeraFormula"`
}

// isDetails implements Details interface.
func (DetailsHybridFormula) isDetails() {}


// isDetails implements Details interface.
func (DetailsGraftChimeraFormula) isDetails() {}

// DetailsUninomial are Uninomial details.
type DetailsUninomial struct {
// Uninomial details.
Expand Down
6 changes: 6 additions & 0 deletions ent/parsed/parsed.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ type Parsed struct {
// - notho- hybrid
// - hybrid formula
Hybrid *Annotation `json:"hybrid,omitempty"`
// GraftChimera is not nil if a name is detected as one of the graft chimeras
//
// - a non-categorized graft chimera
// - named graft chimera
// - graft chimera formula
GraftChimera *Annotation `json:"graftchimera,omitempty"`
// Surrogate is a wide category of names that do not follow
// nomenclatural rules

Expand Down
215 changes: 115 additions & 100 deletions ent/parsed/warning.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ const (
CultivarEpithetWarn
GenusAbbrWarn
GenusUpperCharAfterDash
GraftChimeraCharNoSpaceWarn
GraftChimeraFormulaWarn
GraftChimeraFormulaIncompleteWarn
GraftChimeraFormulaProbIncompleteWarn
GraftChimeraNamedWarn
GreekLetterInRank
HTMLTagsEntitiesWarn
HybridCharNoSpaceWarn
Expand Down Expand Up @@ -63,56 +68,61 @@ const (
)

var warningMap = map[Warning]string{
TailWarn: "Unparsed tail",
ApostrOtherWarn: "Not an ASCII apostrophe",
AuthAmbiguousFiliusWarn: "Ambiguous f. (filius or forma)",
AuthDoubleParensWarn: "Authorship in double parentheses",
AuthExWarn: "Ex authors are not required",
AuthExWithDotWarn: "`ex` ends with a period",
AuthEmendWarn: "Emend authors are not required",
AuthEmendWithoutDotWarn: "`emend` without a period",
AuthMissingOneParensWarn: "Authorship is missing one parenthesis",
AuthQuestionWarn: "Author as a question mark",
AuthShortWarn: "Author is too short",
AuthUnknownWarn: "Author is unknown",
AuthUpperCaseWarn: "Author in upper case",
BacteriaMaybeWarn: "The genus is a homonym of a bacterial genus",
BotanyAuthorNotSubgenWarn: "Possible ICN author instead of subgenus",
CandidatusName: "Bacterial `Candidatus` name",
CanonicalApostropheWarn: "Apostrophe is not allowed in canonical",
CapWordQuestionWarn: "Uninomial word with question mark",
CharBadWarn: "Non-standard characters in canonical",
CultivarEpithetWarn: "Cultivar epithet",
GenusAbbrWarn: "Abbreviated uninomial word",
GenusUpperCharAfterDash: "Apparent genus with capital character after hyphen",
GreekLetterInRank: "Deprecated Greek letter enumeration in rank",
HTMLTagsEntitiesWarn: "HTML tags or entities in the name",
HybridCharNoSpaceWarn: "Hybrid char is not separated by space",
HybridFormulaWarn: "Hybrid formula",
HybridFormulaIncompleteWarn: "Incomplete hybrid formula",
HybridFormulaProbIncompleteWarn: "Probably incomplete hybrid formula",
HybridNamedWarn: "Named hybrid",
LowCaseWarn: "Name starts with low-case character",
NameApproxWarn: "Name is approximate",
NameComparisonWarn: "Name comparison",
RankUncommonWarn: "Uncommon rank",
SpaceMultipleWarn: "Multiple adjacent space characters",
SpaceNonStandardWarn: "Non-standard space characters",
SpanishAndAsSeparator: "Spanish 'y' is used instead of '&'",
SpeciesNumericWarn: "Numeric prefix",
SubgenusAbbrWarn: "Abbreviated subgenus",
SuperspeciesWarn: "Ambiguity: subgenus or superspecies found",
UTF8ConvBadWarn: "Incorrect conversion to UTF-8",
UninomialComboWarn: "Combination of two uninomials",
WhiteSpaceTrailWarn: "Trailing whitespace",
YearCharWarn: "Year with latin character",
YearDotWarn: "Year with period",
YearOrigMisplacedWarn: "Misplaced basionym year",
YearPageWarn: "Year with page info",
YearParensWarn: "Year with parentheses",
YearQuestionWarn: "Year with question mark",
YearRangeWarn: "Years range",
YearSqBracketsWarn: "Year with square brackets",
TailWarn: "Unparsed tail",
ApostrOtherWarn: "Not an ASCII apostrophe",
AuthAmbiguousFiliusWarn: "Ambiguous f. (filius or forma)",
AuthDoubleParensWarn: "Authorship in double parentheses",
AuthExWarn: "Ex authors are not required",
AuthExWithDotWarn: "`ex` ends with a period",
AuthEmendWarn: "Emend authors are not required",
AuthEmendWithoutDotWarn: "`emend` without a period",
AuthMissingOneParensWarn: "Authorship is missing one parenthesis",
AuthQuestionWarn: "Author as a question mark",
AuthShortWarn: "Author is too short",
AuthUnknownWarn: "Author is unknown",
AuthUpperCaseWarn: "Author in upper case",
BacteriaMaybeWarn: "The genus is a homonym of a bacterial genus",
BotanyAuthorNotSubgenWarn: "Possible ICN author instead of subgenus",
CandidatusName: "Bacterial `Candidatus` name",
CanonicalApostropheWarn: "Apostrophe is not allowed in canonical",
CapWordQuestionWarn: "Uninomial word with question mark",
CharBadWarn: "Non-standard characters in canonical",
CultivarEpithetWarn: "Cultivar epithet",
GenusAbbrWarn: "Abbreviated uninomial word",
GenusUpperCharAfterDash: "Apparent genus with capital character after hyphen",
GraftChimeraCharNoSpaceWarn: "Graft-chimera char is not separated by space",
GraftChimeraFormulaWarn: "Graft-chimera formula",
GraftChimeraFormulaIncompleteWarn: "Incomplete graft-chimera formula",
GraftChimeraFormulaProbIncompleteWarn: "Probably incomplete graft-chimera formula",
GraftChimeraNamedWarn: "Named graft-chimera",
GreekLetterInRank: "Deprecated Greek letter enumeration in rank",
HTMLTagsEntitiesWarn: "HTML tags or entities in the name",
HybridCharNoSpaceWarn: "Hybrid char is not separated by space",
HybridFormulaWarn: "Hybrid formula",
HybridFormulaIncompleteWarn: "Incomplete hybrid formula",
HybridFormulaProbIncompleteWarn: "Probably incomplete hybrid formula",
HybridNamedWarn: "Named hybrid",
LowCaseWarn: "Name starts with low-case character",
NameApproxWarn: "Name is approximate",
NameComparisonWarn: "Name comparison",
RankUncommonWarn: "Uncommon rank",
SpaceMultipleWarn: "Multiple adjacent space characters",
SpaceNonStandardWarn: "Non-standard space characters",
SpanishAndAsSeparator: "Spanish 'y' is used instead of '&'",
SpeciesNumericWarn: "Numeric prefix",
SubgenusAbbrWarn: "Abbreviated subgenus",
SuperspeciesWarn: "Ambiguity: subgenus or superspecies found",
UTF8ConvBadWarn: "Incorrect conversion to UTF-8",
UninomialComboWarn: "Combination of two uninomials",
WhiteSpaceTrailWarn: "Trailing whitespace",
YearCharWarn: "Year with latin character",
YearDotWarn: "Year with period",
YearOrigMisplacedWarn: "Misplaced basionym year",
YearPageWarn: "Year with page info",
YearParensWarn: "Year with parentheses",
YearQuestionWarn: "Year with question mark",
YearRangeWarn: "Years range",
YearSqBracketsWarn: "Year with square brackets",
}

var warningStrMap = func() map[string]Warning {
Expand All @@ -125,56 +135,61 @@ var warningStrMap = func() map[string]Warning {

// WarningQualityMap assigns quality of parsing for each warning type.
var WarningQualityMap = map[Warning]int{
TailWarn: 4,
ApostrOtherWarn: 3,
AuthAmbiguousFiliusWarn: 2,
AuthDoubleParensWarn: 4,
AuthExWarn: 2,
AuthExWithDotWarn: 3,
AuthEmendWarn: 2,
AuthEmendWithoutDotWarn: 3,
AuthMissingOneParensWarn: 4,
AuthQuestionWarn: 4,
AuthShortWarn: 3,
AuthUnknownWarn: 2,
AuthUpperCaseWarn: 2,
BacteriaMaybeWarn: 1,
BotanyAuthorNotSubgenWarn: 2,
CandidatusName: 2,
CanonicalApostropheWarn: 3,
CapWordQuestionWarn: 4,
CharBadWarn: 2,
CultivarEpithetWarn: 2,
GenusAbbrWarn: 4,
GenusUpperCharAfterDash: 2,
GreekLetterInRank: 2,
HTMLTagsEntitiesWarn: 3,
HybridCharNoSpaceWarn: 3,
HybridFormulaWarn: 2,
HybridFormulaIncompleteWarn: 4,
HybridFormulaProbIncompleteWarn: 2,
HybridNamedWarn: 2,
LowCaseWarn: 4,
NameApproxWarn: 4,
NameComparisonWarn: 4,
RankUncommonWarn: 3,
SpaceMultipleWarn: 2,
SpaceNonStandardWarn: 2,
SpanishAndAsSeparator: 2,
SpeciesNumericWarn: 3,
SubgenusAbbrWarn: 2,
SuperspeciesWarn: 2,
UTF8ConvBadWarn: 4,
UninomialComboWarn: 2,
WhiteSpaceTrailWarn: 2,
YearCharWarn: 2,
YearDotWarn: 2,
YearOrigMisplacedWarn: 2,
YearPageWarn: 2,
YearParensWarn: 2,
YearQuestionWarn: 2,
YearRangeWarn: 3,
YearSqBracketsWarn: 3,
TailWarn: 4,
ApostrOtherWarn: 3,
AuthAmbiguousFiliusWarn: 2,
AuthDoubleParensWarn: 4,
AuthExWarn: 2,
AuthExWithDotWarn: 3,
AuthEmendWarn: 2,
AuthEmendWithoutDotWarn: 3,
AuthMissingOneParensWarn: 4,
AuthQuestionWarn: 4,
AuthShortWarn: 3,
AuthUnknownWarn: 2,
AuthUpperCaseWarn: 2,
BacteriaMaybeWarn: 1,
BotanyAuthorNotSubgenWarn: 2,
CandidatusName: 2,
CanonicalApostropheWarn: 3,
CapWordQuestionWarn: 4,
CharBadWarn: 2,
CultivarEpithetWarn: 2,
GenusAbbrWarn: 4,
GenusUpperCharAfterDash: 2,
GraftChimeraCharNoSpaceWarn: 3,
GraftChimeraFormulaWarn: 2,
GraftChimeraFormulaIncompleteWarn: 4,
GraftChimeraFormulaProbIncompleteWarn: 2,
GraftChimeraNamedWarn: 2,
GreekLetterInRank: 2,
HTMLTagsEntitiesWarn: 3,
HybridCharNoSpaceWarn: 3,
HybridFormulaWarn: 2,
HybridFormulaIncompleteWarn: 4,
HybridFormulaProbIncompleteWarn: 2,
HybridNamedWarn: 2,
LowCaseWarn: 4,
NameApproxWarn: 4,
NameComparisonWarn: 4,
RankUncommonWarn: 3,
SpaceMultipleWarn: 2,
SpaceNonStandardWarn: 2,
SpanishAndAsSeparator: 2,
SpeciesNumericWarn: 3,
SubgenusAbbrWarn: 2,
SuperspeciesWarn: 2,
UTF8ConvBadWarn: 4,
UninomialComboWarn: 2,
WhiteSpaceTrailWarn: 2,
YearCharWarn: 2,
YearDotWarn: 2,
YearOrigMisplacedWarn: 2,
YearPageWarn: 2,
YearParensWarn: 2,
YearQuestionWarn: 2,
YearRangeWarn: 3,
YearSqBracketsWarn: 3,
}

// QualityWarning is and object that contains the warning and its
Expand Down
2 changes: 2 additions & 0 deletions ent/parsed/words.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
GenusType
InfraspEpithetType
HybridCharType
GraftChimeraCharType
RankType
SpEpithetType
SubgenusType
Expand All @@ -38,6 +39,7 @@ var wordTypeMap = map[WordType]string{
CandidatusType: "CANDIDATUS",
GenusType: "GENUS",
HybridCharType: "HYBRID_CHAR",
GraftChimeraCharType: "GRAFT_CHIMERA_CHAR",
InfraspEpithetType: "INFRASPECIES",
RankType: "RANK",
SpEpithetType: "SPECIES",
Expand Down
Loading

0 comments on commit 5935f18

Please sign in to comment.