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

File metadata

  • Download URL: swarmauri_parser_keywordextractor-0.9.0.dev46.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.dev46.tar.gz
Algorithm Hash digest
SHA256 cf2d9c49e6e404a9e4b1bb659b438f565f85efadf467ea87749efa0f215604e5
MD5 02a9c3da7204867b465e4cdeaf5f0bbb
BLAKE2b-256 3f23f4a1fcdd8c4422a3692adae8d9e703b4ef2b14918425786e426e3217fac4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_parser_keywordextractor-0.9.0.dev46-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.dev46-py3-none-any.whl
Algorithm Hash digest
SHA256 cd668737a65e6e035950d7a80a20d6b742252c5ed767e66351a9320e1a867bff
MD5 6fa78a732f944e5f44bc7af0f54cb02a
BLAKE2b-256 51b36bda8f68a15acb4045265a9852b123382faf6aed263ae707ef0cd8cb9873

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