Skip to main content

A fast implementation of dictionary based named entity recognition.

Project description

PyFastNER
PyFastNER is the python implementation of FastNER, which is orginally developed using Java. It uses hash function to process multiple rules at the same time. Similar to FastNER, PyFastNER supports token-based rules (FastNER--under developing) and character-based rules (FastCNER). It is licensed under the Apache License, Version 2.0.

Install:

pip install PyFastNER
Examples:

Here is a simiple example of using external dictionary to find matches in an input string. It will return a dictionary of spans grouped by the named entity types.

from PyFastNER.FastCNER import FastCNER
# initiate fastner using external rule file
fastner = FastCNER('conf/crule_test.tsv')
# process an input string
res = fastner.processString('Pt came with fever, T 102.0F.')
# display processed results
for type in res.keys():
for span in res[type]:
print(span)
Here is another example if you need process a sentence within a document, where you just need to tell the offset of the sentence to the beginning of the document.

from PyFastNER.FastCNER import FastCNER
fastner = FastCNER('conf/crule_test.tsv')
res = fastner.processString('Pt came with fever, T 102.0F.',134)
For more examples, please refer to TestFastCNER.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyFastNER-1.0.4.dev1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file PyFastNER-1.0.4.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for PyFastNER-1.0.4.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 f61a815f8e525f58f49f4cf73134fe1870bfd4618d59a6ec648801c5f041a437
MD5 84328ed5eab7074673a25782c1b15faf
BLAKE2b-256 621e76b0e33a96f009bffffb11ff0c3319c4778547d63b8455c0cc32ec214006

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page