Skip to main content

A multilingual NER library that handles text, emojis, and multiple languages

Project description

PolyNER

PolyNER is a Python library for multilingual Named Entity Recognition that handles text, emojis, and multiple languages.

Features

  • Language Detection: Automatically detect the language of each text snippet.
  • Tokenization and Normalization: Split text into tokens and normalize them (lowercase, remove punctuation, etc.).
  • Emoji Handling: Detect and properly separate emojis as their own tokens.
  • Data Organization: Output structured data with columns for each category (tokens, language, emojis, recognized entities).
  • Extensibility: Load custom NER models or dictionaries.

Installation

pip install polyner

Quick Start

from polyner import PolyNER

# Initialize the processor
processor = PolyNER()

# Process a text with mixed languages and emojis
text = "Hello world! 你好世界! 😊 Bonjour le monde!"
result = processor.process(text)

# Display the results
print(result)

Output Format

PolyNER returns a pandas DataFrame with the following columns:

  • token: The individual token
  • language: Detected language of the token
  • is_emoji: Boolean indicating if the token is an emoji
  • norm_token: Normalized version of the token
  • entity_label: Entity type if recognized (PERSON, LOC, ORG, etc.)

Using Custom NER Models

import spacy

# Load your custom model
custom_model = spacy.load("your_custom_model")

# Initialize with custom model
processor = PolyNER(ner_model=custom_model)

# Process text
result = processor.process("Your text here with custom entities")

License

MIT

Project details


Download files

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

Source Distribution

polyner-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

polyner-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file polyner-0.1.0.tar.gz.

File metadata

  • Download URL: polyner-0.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for polyner-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a681c01650be8409cb5b2ff638c862745c2be6c0e7e4e2713012c4490a68afae
MD5 2d8577a839380a371e01ba383f8de61d
BLAKE2b-256 70d3670792fac46ad67e96db78596e0a8ea143ca20b408b7d1a32d2c16313a95

See more details on using hashes here.

File details

Details for the file polyner-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: polyner-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for polyner-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4916eb8265296bfa3fc16d2f96a37be8de6b87c519995e27b1d23b5c9d1100b3
MD5 680335330e4892480677461bc5dc8f8c
BLAKE2b-256 af301f663a13eeb30235d3204fb372ac0337b312dc0c0f778a3241460f7b6603

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