Metadata-Version: 2.3
Name: swarmauri_tool_searchword
Version: 0.3.0.dev2
Summary: A tool for searching a specific word or phrase in a file.
License: Apache-2.0
Keywords: search,tool,word,phrase,file,highlight,swarmauri
Author: Vijay Vignesh Prasad Rao
Author-email: vijayvigneshp02@gmail.com
Requires-Python: >=3.10,<3.13
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Development Status :: 3 - Alpha
Requires-Dist: pydantic
Requires-Dist: requests
Requires-Dist: swarmauri_base
Requires-Dist: swarmauri_core
Requires-Dist: swarmauri_standard
Description-Content-Type: text/markdown

![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)

<p align="center">
    <a href="https://pypi.org/project/swarmauri_tool_searchword/">
        <img src="https://img.shields.io/pypi/dm/swarmauri_tool_searchword" alt="PyPI - Downloads"/></a>
    <a href="https://github.com/swarmauri/swarmauri-sdk/pkgs/pkgs/community/swarmauri_tool_searchword">
        <img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https://github.com/swarmauri/swarmauri-sdk/pkgs/pkgs/community/swarmauri_tool_searchword&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false" alt="GitHub Hits"/></a>
    <a href="https://pypi.org/project/swarmauri/swarmauri_tool_searchword">
        <img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_searchword" alt="PyPI - Python Version"/></a>
    <a href="https://pypi.org/project/swarmauri/swarmauri_tool_searchword">
        <img src="https://img.shields.io/pypi/l/swarmauri_tool_searchword" alt="PyPI - License"/></a>
    <br />
    <a href="https://pypi.org/project/swarmauri/swarmauri_tool_searchword">
        <img src="https://img.shields.io/pypi/v/swarmauri_tool_searchword?label=swarmauri_tool_searchword&color=green" alt="PyPI - swarmauri_tool_searchword"/></a>
</p>

---

# `swarmauri_tool_searchword`

A tool for extracting the number of occurances of a word or phrase (case insensitive) within a file. 

## Installation

To install the `swarmauri_tool_searchword` package, you can use pip. Ensure that you have Python 3.10 or newer installed on your system. You can install the package directly from PyPI using the following command:

```bash
pip install swarmauri_tool_searchword
```

If you are using Poetry for dependency management, you can add it to your project by executing:

```bash
poetry add swarmauri_tool_searchword
```

## Usage 

The `swarmauri_tool_searchword` package provides a single class, `SearchWordTool`, to search for specific words or phrases within a file. Below is an example of how to use it.

### Example

```python
from swarmauri_tool_searchword import SearchWordTool

# Create an instance of the SearchWordTool
search_tool = SearchWordTool()

# Specify the file path and the search word
file_path = 'path/to/your/file.txt'
search_word = 'your_search_term'

# Execute the search
result = search_tool(file_path=file_path, search_word=search_word)
print(f"Occurrences of '{search_word}': {result['count']}")
for line in result['lines']:
   print(line)

```

### Functionality

1. **Create an Instance**: Instantiate the `SearchWordTool` class.
2. **Specify Parameters**: Provide the file path and the word or phrase you want to search.
3. **Execute the Search**: Call the instance with the specified parameters to get the occurrences.

This package highlights the occurrences of the search term in the output, making it easy to identify where the term appears in the text.

