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

File metadata

  • Download URL: swarmauri_parser_keywordextractor-0.9.0.dev44.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.dev44.tar.gz
Algorithm Hash digest
SHA256 ae2666a5e6c90723c9a4ceca997f2660da664d30672d1163321010ab4545d873
MD5 356f22b4d39b929307516c1d5d412f93
BLAKE2b-256 7e4d1ea02148903183fd4442111ed7ee80909796f291015e12f3dfbcf856096e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_parser_keywordextractor-0.9.0.dev44-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.dev44-py3-none-any.whl
Algorithm Hash digest
SHA256 f0bd6f829925f558cdab1350b30317f58ba1ddefaf22c296765badc109eb8311
MD5 c7bb6ddebc6f21a45b1c84cd20539def
BLAKE2b-256 0cbc0c5a0427ff087992580b3cb5c77d3f8836c7aadb7b87a12354cfcf0db04b

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