Package: entifyfishing-client
entifyfishing-clientA client library for accessingEntity-fishing- Entity Recognition and DisambiguationUsageFirst, create a client:fromentifyfishing_clientimportClientclient=Client(base_url="http://nerd.huma-num.fr/nerd/service")Now call your endpoint and use your models:fromentifyfishing_client.api.knowledge_baseimportget_concept,term_lookupfromentifyfishing_client.api.query_processingimportdisambiguatefromentifyfishing_client.modelsimport(Concept,DisambiguateForm,Language,QueryParameters,QueryResultFile,QueryResultTermVector,QueryResultText,TermSenses,)fromentifyfishing_client.typesimportFileform=DisambiguateForm(query=QueryParameters(text="""Austria invaded and fought the Serbian army at the Battle of Cer and Battle of Kolubara beginning on 12 August.The army, led by general Paul von Hindenburg defeated Russia in a series of battles collectively known as the First Battle of Tannenberg (17 August – 2 September).But the failed Russian invasion, causing the fresh German troops to move to the east, allowed the tactical Allied victory at the First Battle of the Marne.Unfortunately for the Allies, the pro-German King Constantine I dismissed the pro-Allied government of E. Venizelos before the Allied expeditionary force could arrive.""",language=Language(lang="en"),mentions=["ner","wikipedia"],nbest=False,customisation="generic",min_selector_score=0.2,))r=disambiguate.sync_detailed(client=client,multipart_data=form)ifr.is_success:result:QueryResultText=r.parsedassertresultisnotNoneassertlen(result.entities)>0assertresult.entities[0].raw_name=="Austria"assertresult.entities[0].wikidata_id=="Q40"r=get_concept.sync_detailed(id="Q40",client=client)result:Concept=r.parsedifr.is_success:assertresultisnotNoneassertresult.raw_name=="Austria"assertresult.wikidata_id=="Q40"assertlen(result.statements)>0Or do the same thing with an async version:pdf_file="MyPDFFile.pdf"withpdf_file.open("rb")asfin:form=DisambiguateForm(query=QueryParameters(language=Language(lang="en"),mentions=["wikipedia"],nbest=False,customisation="generic",min_selector_score=0.2,sentence=True,structure="grobid",),file=File(file_name=pdf_file.name,payload=fin,mime_type="application/pdf"),)r=awaitdisambiguate.asyncio_detailed(client=client,multipart_data=form)ifr.is_success:result:QueryResultFile=r.parsedassertresultisnotNoneassertlen(result.entities)>0assertlen(result.pages)>0assertlen(result.entities[0].pos)>0By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.client=Client(base_url="http://nerd.huma-num.fr/nerd/service",verify_ssl="/path/to/certificate_bundle.pem",)You can also disable certificate validation altogether, but beware thatthis is a security risk.client=Client(verify_ssl=False)Things to know:Every path/method combo becomes a Python module with four functions:sync: Blocking request that returns parsed data (if successful) orNonesync_detailed: Blocking request that always returns aRequest, optionally withparsedset if the request was successful.asyncio: Likesyncbut the async instead of blockingasyncio_detailed: Likesync_detailedby async instead of blockingAll path/query params, and bodies become method arguments.If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)Any endpoint which did not have a tag will be inentifyfishing_client.api.defaultBuilding / publishing this ClientThis project usesPoetryto manage dependencies  and packaging.  Here are the basics:Update the metadata in pyproject.toml (e.g. authors, version)If you're using a private repository, configure it with Poetrypoetry config repositories.<your-repository-name> <url-to-your-repository>poetry config http-basic.<your-repository-name> <username> <password>Publish the client withpoetry publish --build -r <your-repository-name>or, if for public PyPI, justpoetry publish --buildIf you want to install this client into another project without publishing it (e.g. for development) then:If that projectis using Poetry, you can simply dopoetry add <path-to-this-client>from that projectIf that project is not using Poetry:Build a wheel withpoetry build -f wheelInstall that wheel from the other projectpip install <path-to-wheel>