Skip to main content

Keyword Extractor Parser for Swarmauri.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_parser_keywordextractor


Swarmauri Parser Keywordextractor

KeywordExtractorParser wraps the YAKE keyword extraction library to turn arbitrary text into a ranked list of swarmauri_standard.documents.Document instances. Each returned document stores the detected keyword in content and the YAKE importance score in metadata["score"].

The parser normalizes any input into a string before analysis and, by default, extracts up to 10 keywords using the English language model, three-word maximum phrases, and YAKE's sequence-matching deduplication (dedupLim=0.9). Override lang or num_keywords when instantiating the parser to tailor the output to your dataset.

Installation

Choose the tool that matches your workflow:

# pip
pip install swarmauri_parser_keywordextractor

# Poetry
poetry add swarmauri_parser_keywordextractor

# uv
uv add swarmauri_parser_keywordextractor

Usage

Here's a basic example of how to use the KeywordExtractorParser:

from swarmauri_parser_keywordextractor import KeywordExtractorParser

# Initialize the parser for three keywords in English
parser = KeywordExtractorParser(num_keywords=3, lang="en")

text = "Artificial intelligence and machine learning are transforming technology"
documents = parser.parse(text)

for document in documents:
    score = document.metadata["score"]
    print(f"Keyword: {document.content}, Score: {score:.4f}")

Each call to parse returns a list of Document objects ranked by YAKE so you can feed them directly into downstream Swarmauri pipelines.

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

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

Built Distribution

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

File details

Details for the file swarmauri_parser_keywordextractor-0.9.0.dev45.tar.gz.

File metadata

  • Download URL: swarmauri_parser_keywordextractor-0.9.0.dev45.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_parser_keywordextractor-0.9.0.dev45.tar.gz
Algorithm Hash digest
SHA256 f6bdd80a00044246ad4a8cb6c2334440632e5ca0b68dd6ec40322e0953bbfa55
MD5 33fe770ba722d052fb5596e38965068e
BLAKE2b-256 8bb1127ea2d2a915c2d8b9e0593e872b261e51a6ad3385038d878911831680ba

See more details on using hashes here.

File details

Details for the file swarmauri_parser_keywordextractor-0.9.0.dev45-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_parser_keywordextractor-0.9.0.dev45-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_parser_keywordextractor-0.9.0.dev45-py3-none-any.whl
Algorithm Hash digest
SHA256 8b609c715724a8896402f021cea0f6c9daddb08f9a4f1f8b9097c5b3d4ab5191
MD5 26afe4856c329bd08551d8bfb0b3fa9b
BLAKE2b-256 a2dc1897c88a974cb0f9e0eea8588288dd1453d66f397ba795763c968a2ebd07

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