Coder Social home page Coder Social logo

taxon_parser's People

Contributors

aroche avatar

Watchers

 avatar

Forkers

ekoblogist tmosr

taxon_parser's Issues

are all functions available? how to call them?

First of all, thank you very much for porting this to Python.
Is this finished, or is it a work in progress?

The main page says "Results of the parsing are ParsedName objects. These have the following attributes and functions: ..."
Among them, you mention nameMinimal(), but I can't figure out how to make this and other functions work.
This is what I tried based on your example code:

from taxon_parser import TaxonParser, UnparsableNameException

parser = TaxonParser("Abies pectinata mill.")
try:
    parsed_name = parser.parse()
    print(parsed_name)
    # HERE I ADDED THESE:
    print(parsed_name.genus)  # THIS WORKS
    # TRY TO PRINT A SIMPLE NAME:
    print(parsed_name.nameMinimal())  # THIS FAILS
except UnparsableNameException as e:
    print("this name does not seem to be a valid taxon name: \n" + e )

But I am getting this error:

AttributeError: 'ParsedName' object has no attribute 'nameMinimal'

I am Python newbie. Could you please tell me what is the correct syntax to call these functions?
I tried to follow this suggestion in StackOverflow, and I found some other methods with names different to those mentioned in taxon_parser documentation (like canonicalNameComplete or canonicalNameMinimal)... but they also raised errors when I used them instead of nameMinimal in the above code:

Trying canonicalNameMinimal I got this error:

Traceback (most recent call last):
  File "nomenclature.py", line 10, in parsename
    print(parsed_name.canonicalNameMinimal())
  File "C:\Python38\lib\site-packages\taxon_parser\name_parser_api\parsedname.py", line 231, in canonicalNameMinimal
    return nameformatter.canonicalMinimal(self)
  File "C:\Python38\lib\site-packages\taxon_parser\name_parser_api\util\nameformatter.py", line 43, in canonicalMinimal
    return buildName(n, False, False, False, False, False, True, True, False, False, False, False, False, False)
  File "C:\Python38\lib\site-packages\taxon_parser\name_parser_api\util\nameformatter.py", line 227, in buildName
    name = unicodeutils.ascii(name)
  File "C:\Python38\lib\site-packages\taxon_parser\name_parser_api\util\unicodeutils.py", line 14, in ascii
    return ''.join(c for c in unicodedata.normalize('NFD', s)
NameError: name 's' is not defined

Trying canonicalNameComplete I got this error:

Traceback (most recent call last):
  File "nomenclature.py", line 10, in parsename
    print(parsed_name.canonicalNameComplete())
  File "C:\Python38\lib\site-packages\taxon_parser\name_parser_api\parsedname.py", line 235, in canonicalNameComplete
    return nameformatter.canonicalComplete(self)
  File "C:\Python38\lib\site-packages\taxon_parser\name_parser_api\util\nameformatter.py", line 51, in canonicalComplete
    return buildName(n, True, True, True, True, True, True, False, True, True, True, True, True, True)
  File "C:\Python38\lib\site-packages\taxon_parser\name_parser_api\util\nameformatter.py", line 204, in buildName
    if showSensu and n.getTaxonomicNote() is not None:
AttributeError: 'ParsedName' object has no attribute 'getTaxonomicNote'

BTW, documentation shows two different versions of canonicalName() function (I guess one of them is wrong):

ParsedName.canonicalName(): A full scientific name with authorship from the individual properties in its canonical form. Autonyms are rendered without authorship and subspecies are using the subsp rank marker unless a name is assigned to the zoological code.

ParsedName.canonicalName(): A full scientific name just as canonicalName, but without any authorship.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.