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.dev33.tar.gz.

File metadata

  • Download URL: swarmauri_parser_keywordextractor-0.9.0.dev33.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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.dev33.tar.gz
Algorithm Hash digest
SHA256 977cf1fe88da46ca62a1d75b22f773cf5093e3d7ca212237dc16633906fa9867
MD5 d4a00b94d2fd69d00959e7726f3545a6
BLAKE2b-256 278da856c82e7446eaa5f674e244601a7ad2993d8fc2a9bfb6d36465c44fdf06

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_parser_keywordextractor-0.9.0.dev33-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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.dev33-py3-none-any.whl
Algorithm Hash digest
SHA256 43b74e6c9ae4c99ace7dff095aa151e677a07561aa59648cbe1f6f038789b771
MD5 bf661d98b8e7e224a6cd98e0230b0e29
BLAKE2b-256 4ffd336126e5a4ce5342a645ef81c1d39df3264e30d1a126113d455764adf76c

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