ner-agent
A simple, language-agnostic Named Entity Recognition (NER) agent powered by LLMs.
Features
- Multilingual: Supports English, Chinese, Japanese, Korean, French, German, Russian, Spanish, and more.
- Entity Types: Recognizes PERSON, NORP (nationalities, religions, political groups, languages), LOCATION, DATETIME, NUMERIC, and PROPER_NOUN (events, works, organizations, products, etc.).
- Easy Integration: Use as a Python library with a simple async API.
- Tested: Includes comprehensive test cases for multiple languages and entity types.
Installation
pip install ner-agent
Or clone and install locally:
git clone https://github.com/allen2c/ner-agent.git
cd ner-agent
pip install .
Python 3.11+ required.
Usage
import asyncio
from ner_agent import NerAgent
async def main():
agent = NerAgent()
text = "Elon Musk visited Tesla's Gigafactory in Austin on March 15, 2024, announcing a 20% increase."
result = await agent.run(text)
for entity in result.entities:
print(entity)
asyncio.run(main())
Output:
name='PERSON' value='Elon Musk' start=0 end=9
name='PROPER_NOUN' value='Tesla' start=18 end=23
name='LOCATION' value='Gigafactory' start=26 end=37
...
Entity Types
PERSON: People, including fictional characters.NORP: Nationalities, religious groups, political groups, languages.LOCATION: Geopolitical entities, facilities, places.DATETIME: Dates, times, periods, ages.NUMERIC: Numbers, money, quantities, percentages, ordinals/cardinals.PROPER_NOUN: Named events, works, laws, products, organizations, companies, etc.
Testing
To run the tests:
pytest
Configuration
- By default, uses OpenAI-compatible LLMs via openai-agents.
- You can configure the model and OpenAI client (see
tests/conftest.pyfor examples).
License
MIT License
For more details, see ner_agent/init.py and the tests.
If you need more advanced usage or want to contribute, please check the GitHub repository.
Metadata
Release files for ner-agent 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ner_agent-0.4.1.tar.gz | 9.2 kB | Without provenance | Details for ner_agent-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ner_agent-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for ner_agent-0.4.1-py3-none-any.whl |
Total release size: 19.1 kB
Release files / ner_agent-0.4.1.tar.gz
| Download URL | ner_agent-0.4.1.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
297a679178172988109f771e6ec200de9bfb5c7d4cb6eb420460e586b2946cf0
|
|
BLAKE2b-256 checksum How to use checksums |
9e3630e39db8ed1a08b5d49b6a5fa92ae9850bf84c306775cecdb679c6aa02a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.4 CPython/3.11.13 Darwin/24.6.0
|
Release files / ner_agent-0.4.1-py3-none-any.whl
| Download URL | ner_agent-0.4.1-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea227076cc4b9e9c80a81012dbe3bd97a038b9f07aa4de61f00c96a52ba00f78
|
|
BLAKE2b-256 checksum How to use checksums |
615af19b9d783da7f034ccc6402f30416133195b02c746622f4e330b0c7fd95e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.4 CPython/3.11.13 Darwin/24.6.0
|
Security for ner-agent 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.