NER analyzer package with CLI and export options
Project description
ner_analyzer_cli_v2
A simple Named Entity Recognition (NER) analyzer package with a command-line interface (CLI) and export options for JSON and CSV. Powered by spaCy and supporting multiple languages.
Features
- Analyze text for named entities using spaCy.
- Supports multiple languages (
en,fr,de,es,pt). - Export results to JSON or CSV files.
- Shows entity frequency statistics.
- Easy-to-use CLI interface.
Installation
First, install the package (after cloning or downloading):
pip install ner_analyzer_cli_v2
You must also download the relevant spaCy language model(s) as needed. For example:
python -m spacy download en_core_web_sm
python -m spacy download fr_core_news_sm
# For other languages, see: https://spacy.io/models
CLI Usage
ner-analyze "Your text to analyze here"
Options
--output <file>: Specify output file (.jsonor.csv).--lang <code>: Specify language code (en,fr,de,es,pt). Default isen.
Example
Analyze some text and export results:
ner-analyze "Barack Obama was born in Hawaii." --output results.json
ner-analyze "Emmanuel Macron est le président français." --lang fr --output results.csv
Output Example
Console
Entities:
[
{
"text": "Barack Obama",
"label": "PERSON"
},
{
"text": "Hawaii",
"label": "GPE"
}
]
Frequency:
{'PERSON': 1, 'GPE': 1}
JSON
{
"entities": [
{"text": "Barack Obama", "label": "PERSON"},
{"text": "Hawaii", "label": "GPE"}
],
"frequency": {"PERSON": 1, "GPE": 1}
}
CSV
Entity,Label
Barack Obama,PERSON
Hawaii,GPE
Label,Count
PERSON,1
GPE,1
API Usage
You can also use the NERAnalyzer class directly in your Python scripts:
from ner_analyzer.cli import NERAnalyzer
analyzer = NERAnalyzer(lang_model="en_core_web_sm")
entities = analyzer.analyze_text("Angela Merkel was Chancellor of Germany.")
print(entities)
License
MIT License
Author
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ner_analyzer_cli_v2-0.3.tar.gz.
File metadata
- Download URL: ner_analyzer_cli_v2-0.3.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21a6ec44d73d8931ab12db4b7ee53828224b5edde375fb9b6ff6d39770bfab98
|
|
| MD5 |
e1f523ff812619c2b15fb4f30a56d23e
|
|
| BLAKE2b-256 |
76eba91ab19c722d93cade8b5ade68b25dc0ef9540e2d57053f962ae2b0407f1
|
File details
Details for the file ner_analyzer_cli_v2-0.3-py3-none-any.whl.
File metadata
- Download URL: ner_analyzer_cli_v2-0.3-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f33a0e33af417619bcadcf788b70f19949c7673ecdb7257a38b6c27ac283e50
|
|
| MD5 |
c8e1851a881db8026c926cc59064fb73
|
|
| BLAKE2b-256 |
9127e278e72c6239ac4734af0eb98a4e95f20cbc640bd56feaba3e9a94c2d63c
|