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

File metadata

  • Download URL: swarmauri_parser_keywordextractor-0.9.0.dev47.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.dev47.tar.gz
Algorithm Hash digest
SHA256 2a1277cbf3085b55b5f65ef1c7283bf0bdfd4a96cff45d765ac87c29da7cdfc6
MD5 f66cfb8d327ff9ad6cbdd3c505e2aa45
BLAKE2b-256 5a5ecea646e3d8ac4032d6a8b9215f66c533815bbf9b116ccbbafee325bc73c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_parser_keywordextractor-0.9.0.dev47-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.dev47-py3-none-any.whl
Algorithm Hash digest
SHA256 00f6ee872fe28adaa94984831cd60ffe093d900f4aefc369477b9562e0b11002
MD5 a3e852ad205353467553b3082950df53
BLAKE2b-256 59408b7acb210a58e7e8035b1f9c6a626712786480d75f60b746271c4b09c970

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