name-parser/src/main/java/org/gbif/nameparser/ParsingJob.java
/**
   * Identifies a name type, defaulting to SCIENTIFIC_NAME so that type is never null
   */
Identifies a name type, defaulting to SCIENTIFIC_NAME so that type is never null
Identifies a name type defaulting to SCIENTIFIC_NAME so that type is never null
private void determineNameType(String normedName) {
    if (pn.getType() == null || pn.getType().isParsable()) {
      if (pn.getUninomial() != null && Character.isLowerCase(normedName.charAt(0))) {
        pn.addWarning(Warnings.LC_MONOMIAL);
        pn.setDoubtful(true);
        setTypeIfNull(pn, NameType.INFORMAL);
      } else if (pn.getRank().notOtherOrUnranked()) {
        if (pn.isPhraseName()) {
          pn.setType(NameType.INFORMAL);
        } else if (pn.isIndetermined()) {
          pn.setType(NameType.INFORMAL);
          pn.addWarning(Warnings.INDETERMINED);
        } else if (pn.getRank().isSupraspecific() && (pn.getSpecificEpithet() != null || pn.getInfraspecificEpithet() != null)) {
          pn.addWarning(Warnings.RANK_MISMATCH);
          pn.setDoubtful(true);
          pn.setType(NameType.INFORMAL);
        } else if (!pn.getRank().isSpeciesOrBelow() && pn.isBinomial()) {
          pn.addWarning(Warnings.HIGHER_RANK_BINOMIAL);
          pn.setDoubtful(true);
        }
      }
      if (pn.getType() == null) {
        if (pn.isAbbreviated() || pn.isIncomplete()) {
          pn.setType(NameType.INFORMAL);
        } else if ("?".equals(pn.getUninomial()) || "?".equals(pn.getGenus()) || "?".equals(pn.getSpecificEpithet())) {
          pn.setType(NameType.PLACEHOLDER);
        } else {
          pn.setType(NameType.SCIENTIFIC);
        }
      }
    }
  }
private void determineNameType ( String normedName ) { if ( pn . getType ( ) == null || pn . getType ( ) . isParsable ( ) ) { if ( pn . getUninomial ( ) != null && Character . isLowerCase ( normedName . charAt ( 0 ) ) ) { pn . addWarning ( Warnings . LC_MONOMIAL ) ; pn . setDoubtful ( true ) ; setTypeIfNull ( pn , NameType . INFORMAL ) ; } else if ( pn . getRank ( ) . notOtherOrUnranked ( ) ) { if ( pn . isPhraseName ( ) ) { pn . setType ( NameType . INFORMAL ) ; } else if ( pn . isIndetermined ( ) ) { pn . setType ( NameType . INFORMAL ) ; pn . addWarning ( Warnings . INDETERMINED ) ; } else if ( pn . getRank ( ) . isSupraspecific ( ) && ( pn . getSpecificEpithet ( ) != null || pn . getInfraspecificEpithet ( ) != null ) ) { pn . addWarning ( Warnings . RANK_MISMATCH ) ; pn . setDoubtful ( true ) ; pn . setType ( NameType . INFORMAL ) ; } else if ( ! pn . getRank ( ) . isSpeciesOrBelow ( ) && pn . isBinomial ( ) ) { pn . addWarning ( Warnings . HIGHER_RANK_BINOMIAL ) ; pn . setDoubtful ( true ) ; } } if ( pn . getType ( ) == null ) { if ( pn . isAbbreviated ( ) || pn . isIncomplete ( ) ) { pn . setType ( NameType . INFORMAL ) ; } else if ( "?" . equals ( pn . getUninomial ( ) ) || "?" . equals ( pn . getGenus ( ) ) || "?" . equals ( pn . getSpecificEpithet ( ) ) ) { pn . setType ( NameType . PLACEHOLDER ) ; } else { pn . setType ( NameType . SCIENTIFIC ) ; } } } }
Identifies a name type, defaulting to SCIENTIFIC_NAME so that type is never null
Identifies a name type defaulting to SCIENTIFIC_NAME so that type is never null
// all rules below do not apply to unparsable names // if we only match a monomial in the 3rd pass its suspicious // an abbreviated name? // a placeholder epithet only // anything else looks fine!