FactSet NER client library for Python
Project description
FactSet NER client library for Python
Extract named entities and their FactSet entity IDs from given document text.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.5.0
- Package version: 0.8.1
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Requirements
- Python >= 3.6
Installation
Poetry
poetry add fds.sdk.utils fds.sdk.FactSetNER
pip
pip install fds.sdk.utils fds.sdk.FactSetNER
Usage
- Generate authentication credentials.
- Setup Python environment.
-
Install and activate python 3.6+. If you're using pyenv:
pyenv install 3.9.7 pyenv shell 3.9.7
-
(optional) Install poetry.
-
- Install dependencies.
- Run the following:
from fds.sdk.utils.authentication import ConfidentialClient
import fds.sdk.FactSetNER
from fds.sdk.FactSetNER.api import entities_api
from fds.sdk.FactSetNER.model.request import Request
from fds.sdk.FactSetNER.model.response import Response
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
# Examples for each supported authentication method are below,
# choose one that satisfies your use case.
# (Preferred) OAuth 2.0: FactSetOAuth2
# See https://github.com/FactSet/enterprise-sdk#oauth-20
# for information on how to create the app-config.json file
# See https://github.com/FactSet/enterprise-sdk-utils-python#authentication
# for more information on using the ConfidentialClient class
configuration = fds.sdk.FactSetNER.Configuration(
fds_oauth_client = ConfidentialClient('/path/to/app-config.json')
)
# Basic authentication: FactSetApiKey
# See https://github.com/FactSet/enterprise-sdk#api-key
# for information how to create an API key
# configuration = fds.sdk.FactSetNER.Configuration(
# username = 'USERNAME-SERIAL',
# password = 'API-KEY'
# )
# Enter a context with an instance of the API client
with fds.sdk.FactSetNER.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = entities_api.EntitiesApi(api_client)
payload = Request(
input=Input(
text="As demand for the coronavirus vaccine plateaus, Ohio Governor Mike DeWine is giving state residents a shot to win $1 million. Starting May 26, the state will award $1 million each week to an adult who has received at least the first dose of the COVID-19 vaccine, DeWine said. There will be five total drawings. This will give anyone who has not been vaccinated time to get the first dose of Pfizer or Moderna and be well on the way to full immunity, DeWine said Wednesday. West Virginia Governor Jim Justice wanted to give every vaccinated resident between the ages of 16 and 35 a $100 savings bond. States and localities have been given wide discretion by the Treasury Department in spending federal aid.",
character_offset=0,
id_type="entityId",
filter_tags_without_id=True,
),
) # Request | (optional)
try:
api_response = api_instance.post_entities_entities(payload=payload)
pprint(api_response)
except fds.sdk.FactSetNER.ApiException as e:
print("Exception when calling EntitiesApi->post_entities_entities: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to https://api-sandbox.factset.com
Class | Method | HTTP request | Description |
---|---|---|---|
EntitiesApi | post_entities_entities | POST /cognitive/ner/v1/entities |
Documentation For Models
Documentation For Authorization
FactSetApiKey
- Type: HTTP basic authentication
FactSetOAuth2
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes: N/A
Notes for Large OpenAPI documents
If the OpenAPI document is large, imports in fds.sdk.FactSetNER.apis and fds.sdk.FactSetNER.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:
Solution 1: Use specific imports for apis and models like:
from fds.sdk.FactSetNER.api.default_api import DefaultApi
from fds.sdk.FactSetNER.model.pet import Pet
Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:
import sys
sys.setrecursionlimit(1500)
import fds.sdk.FactSetNER
from fds.sdk.FactSetNER.apis import *
from fds.sdk.FactSetNER.models import *
Contributing
Please refer to the contributing guide.
Copyright
Copyright 2022 FactSet Research Systems Inc
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for fds.sdk.FactSetNER-0.8.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 069735197c64dfac85c8b6930d72222764d76bf653dc131edf00711deaea46cd |
|
MD5 | 307aefcb8c1b8eadddad0b0e094dfb48 |
|
BLAKE2b-256 | c2c76b8429fa69d14a4c408174acb0511c86b4cd115ed6b8fa876364188adca1 |