kawadi is a versatile tool that used as a form of weapon and is used to cut, shape and split wood.

Overview

kawadi

Build Status Code Coverage kawadi

kawadi (કવાડિ in Gujarati) (Axe in English) is a versatile tool that used as a form of weapon and is used to cut, shape and split wood.

kawadi is collection of small tools that I found useful for me more often. Currently it contains text search which searches a string inside another string.

Text Search

Text search in kawadi uses sliding window technique to search for a word or phrase in another text. The step size in the sliding window is 1 and the window size is the size of the word/phrase we are interested in.

For example, if the text we are interested in searching is "The big brown fox jumped over the lazy dog" and the word that we want to search is "brown fox".

len(["brown", ["fox"]]) slides = sliding_window(text, window_size) -> ['The', 'big']['big', 'brown']['brown', 'fox']['fox', 'jumped']['jumped', 'over']['over', 'the']['the', 'lazy']['lazy', 'dog'] for each slide in slides score(" ".join(slide), interested_word) if score >= threshold then select slide else continue ">
text = "The big brown fox jumped over the lazy dog"
interested_word = "brown fox"
window_size = len(interested.split()) -> len(["brown", ["fox"]])

slides = sliding_window(text, window_size) -> ['The', 'big']['big', 'brown']['brown', 'fox']['fox', 'jumped']['jumped', 'over']['over', 'the']['the', 'lazy']['lazy', 'dog']

for each slide in slides
  score(" ".join(slide), interested_word)
  if score >= threshold then
    select slide
  else
    continue

Currently, there are 3 similarity scores are calculated and averaged to calculate the final score. These similarity scores are Cosine, JaroWinkler and Normalized Levinstine similarities.

In development

  • Add functionality to accept custom user similarity metrics.
  • [] Generate documentation.
  • [] Write the custom counter

You can follow the project development in the Projects tab.

Quick Start

from kawadi.text_search import SearchInText

search = SearchInText()

text_to_find = "String distance algorithm"
text_to_search = """SIFT4 is a general purpose string distance algorithm inspired by JaroWinkler and Longest Common Subsequence. It was developed to produce a distance measure that matches as close as possible to the human perception of string distance. Hence it takes into account elements like character substitution, character distance, longest common subsequence etc. It was developed using experimental testing, and without theoretical background."""

result = search.find_in_text(text_to_find, text_to_search)

print(result)
[
    {
        "sim_score": 1.0,
        "searched_text": "string distance algorithm",
        "to_find": "string distance algorithm",
        "start": 27,
        "end": 52,
    }
]

If the text that needs to be searched is big, SearchInText can utilize multiprocessing to make the search fast.

from kawadi.text_search import SearchInText

search = SearchInText(multiprocessing=True, max_workers=8)

Custom user defined score calculation.

Its often the case that the provided string similarity score is not enough for the use case that you may have. For this very case, you can add, your own score calculation.

from kawadi.text_search import SearchInText


def my_custom_fun(**kwargs):

  slide_of_text:str = kwargs["slide_of_text"]
  text_to_find:str = kwargs["text_to_find"]

  # Here you can then go on to do preprocessing if you like,
  # or use them to count char based n-gram string matching scores.

  return score: float

search = SearchInText(search_threshold=0.9, custom_score_func= your custom func)

This custom score function will have access to two things slide_of_text for every slide in text (From the example above, "The big", "big brown" and so on...) and text_to_find.

Note: The return type of this custom function should be same as the type of search_threshold as you can see from the above example.

Installation

Stable Release: pip install kawadi
Development Head: pip install git+https://github.com/jdvala/kawadi.git

Development

See CONTRIBUTING.md for information related to developing the code.

Free software: MIT license

You might also like...
A simple tool to extract python code from a Jupyter notebook, and then run pylint on it for static analysis.

Jupyter Pylinter A simple tool to extract python code from a Jupyter notebook, and then run pylint on it for static analysis. If you find this tool us

A python tool give n number of inputs and parallelly you will get a output by separetely

http-status-finder Hello Everyone!! This is kavisurya, In this tool you can give n number of inputs and parallelly you will get a output by separetely

NetConfParser is a tool that helps you analyze the rpcs coming and going from a netconf client to a server

NetConfParser is a tool that helps you analyze the rpcs coming and going from a netconf client to a server

Basic loader is a small tool that will help you generating Cloudflare cookies

Basic Loader Cloudflare cookies loader This tool may help some people getting valide cloudflare cookies Installation 🔌 : pip install -r requirements.

Python tool to check a web applications compliance with OWASP HTTP response headers best practices

Check Your Head A quick and easy way to check a web applications response headers!

A tool for testing improper put method vulnerability
A tool for testing improper put method vulnerability

Putter-CUP A tool for testing improper put method vulnerability Usage :- python3 put.py -f live-subs.txt Result :- The result in txt file "result.txt"

Tool for generating Memory.scan() compatible instruction search patterns

scanpat Tool for generating Frida Memory.scan() compatible instruction search patterns. Powered by r2. Examples $ ./scanpat.py arm.ks:64 'sub sp, sp,

Stubmaker is an easy-to-use tool for generating python stubs.

Stubmaker is an easy-to-use tool for generating python stubs. Requirements Stubmaker is to be run under Python 3.7.4+ No side effects during

PyHook is an offensive API hooking tool written in python designed to catch various credentials within the API call.
PyHook is an offensive API hooking tool written in python designed to catch various credentials within the API call.

PyHook is the python implementation of my SharpHook project, It uses various API hooks in order to give us the desired credentials. PyHook Uses

Comments
  • :sparkles: Accept custom user defined score functions

    :sparkles: Accept custom user defined score functions

    This pull request adds feature to accept user defined custom score function for calculating string similarity.

    Pull request recommendations:

    • [x] Name your pull request your-development-type/short-description. Ex: feature/read-tiff-files
    • [ ] Link to any relevant issue in the PR description. Ex: Resolves [gh-12], adds tiff file format support
    • [x] Provide context of changes.
    • [x] Provide relevant tests for your feature or bug fix.
    • [x] Provide or update documentation for any feature added by your pull request.

    Thanks for contributing!

    opened by jdvala 1
Releases(0.0.2)
  • 0.0.2(Oct 31, 2021)

    What's Changed

    • :memo: Update README.md by @jdvala in https://github.com/jdvala/kawadi/pull/1
    • :memo: Fix README.md by @jdvala in https://github.com/jdvala/kawadi/pull/2
    • :memo: Rename repo to Kawadi by @jdvala in https://github.com/jdvala/kawadi/pull/3
    • :sparkles: Accept custom user defined score functions by @jdvala in https://github.com/jdvala/kawadi/pull/4
    • :memo: update setup.py to read README for long description. by @jdvala in https://github.com/jdvala/kawadi/pull/5

    New Contributors

    • @jdvala made their first contribution in https://github.com/jdvala/kawadi/pull/1

    Full Changelog: https://github.com/jdvala/kawadi/commits/0.0.2

    Source code(tar.gz)
    Source code(zip)
  • 0.0.1(Oct 31, 2021)

    What's Changed

    • :memo: Update README.md by @jdvala in https://github.com/jdvala/kawadi/pull/1
    • :memo: Fix README.md by @jdvala in https://github.com/jdvala/kawadi/pull/2
    • :memo: Rename repo to Kawadi by @jdvala in https://github.com/jdvala/kawadi/pull/3
    • :sparkles: Accept custom user defined score functions by @jdvala in https://github.com/jdvala/kawadi/pull/4
    • :memo: update setup.py to read README for long description. by @jdvala in https://github.com/jdvala/kawadi/pull/5

    New Contributors

    • @jdvala made their first contribution in https://github.com/jdvala/kawadi/pull/1

    Full Changelog: https://github.com/jdvala/kawadi/commits/0.0.1

    Source code(tar.gz)
    Source code(zip)
Owner
Jay Vala
Data Scientist at scoutbee
Jay Vala
Python code to divide big numbers

divide-big-num Python code to divide big numbers

VuMinhNgoc 1 Oct 15, 2021
Utility to extract Fantasy Grounds Unity Line-of-sight and lighting files from a Univeral VTT file exported from Dungeondraft

uvtt2fgu Utility to extract Fantasy Grounds Unity Line-of-sight and lighting files from a Univeral VTT file exported from Dungeondraft This program wo

Andre Kostur 29 Dec 05, 2022
A quick random name generator

Random Profile Generator USAGE & CREDITS Any public or priavte demonstrative usage of this project is strictly prohibited, UNLESS WhineyMonkey10 (http

2 May 05, 2022
EthTx - Ethereum transactions decoder

EthTx - Ethereum transactions decoder Installation pip install ethtx Requirements The package needs a few external resources, defined in EthTxConfig o

398 Dec 25, 2022
async parser for JET

This project is mainly aims to provide an async parsing option for NTDS.dit database file for obtaining user secrets.

15 Mar 08, 2022
We provide useful util functions. When adding a util function, please add a description of the util function.

Utils Collection Motivation When we implement codes, we often search for util functions that are already implemented. Here, we are going to share util

6 Sep 09, 2021
A python package for your Kali Linux distro that find the fastest mirror and configure your apt to use that mirror

Kali Mirror Finder Using Single Python File A python package for your Kali Linux distro that find the fastest mirror and configure your apt to use tha

MrSingh 6 Dec 12, 2022
Brainfuck rollup scaling experiment for fun

Optimistic Brainfuck Ever wanted to run Brainfuck on ethereum? Don't ask, now you can! And at a fraction of the cost, thanks to optimistic rollup tech

Diederik Loerakker 48 Dec 28, 2022
✨ Un générateur de mot de passe aléatoire totalement fait en Python par moi, et en français.

Password Generator ❗ Un générateur de mot de passe aléatoire totalement fait en Python par moi, et en français. 🔮 Grâce a une au module random et str

MrGabin 3 Jul 29, 2021
Simple integer-valued time series bit packing

Smahat allows to encode a sequence of integer values using a fixed (for all values) number of bits but minimal with regards to the data range. For example: for a series of boolean values only one bit

Ghiles Meddour 7 Aug 27, 2021
A tiny Python library for generating public IDs from integers

pids Create short public identifiers based on integer IDs. Installation pip install pids Usage from pids import pid public_id = pid.from_int(1234) #

Simon Willison 7 Nov 11, 2021
This program organizes automatically files in folders named as file's extension

Auto Sorting System by Sergiy Grimoldi - V.0.0.2 This program organizes automatically files in folders named as file's extension How to use the code T

Sergiy Grimoldi 1 Jan 07, 2022
SmarTool - Smart Util Tool for Python

A set of tools that keep Python sweeter.

Liu Tao 9 Sep 30, 2022
Python Yeelight YLKG07YL/YLKG08YL dimmer handler

With this class you can receive, decrypt and handle Yeelight YLKG07YL/YLKG08YL dimmer bluetooth notifications in your python code.

12 Dec 26, 2022
Script for generating Hearthstone card spoilers & checklists

This is a script for generating text spoilers and set checklists for Hearthstone. Installation & Running Python 3.6 or higher is required. Copy/clone

John T. Wodder II 1 Oct 11, 2022
Build capture utility for Linux

CX-BUILD Compilation Database alternative Build Prerequisite the CXBUILD uses linux system call trace utility called strace which was customized. So I

GLaDOS (G? L? Automatic Debug Operation System) 3 Nov 03, 2022
ecowater-softner is a Python library for collecting information from Ecowater water softeners.

Ecowater Softner ecowater-softner is a Python library for collecting information from Ecowater water softeners. Installation Use the package manager p

6 Dec 08, 2022
Produce a simulate-able SDF of an arbitrary mesh with convex decomposition.

Mesh-to-SDF converter Given a (potentially nasty, nonconvex) mesh, automatically creates an SDF file that describes that object. The visual geometry i

Greg Izatt 22 Nov 23, 2022
Stubmaker is an easy-to-use tool for generating python stubs.

Stubmaker is an easy-to-use tool for generating python stubs. Requirements Stubmaker is to be run under Python 3.7.4+ No side effects during

Toloka 24 Aug 28, 2022
Astvuln is a simple AST scanner which recursively scans a directory, parses each file as AST and runs specified method.

Astvuln Astvuln is a simple AST scanner which recursively scans a directory, parses each file as AST and runs specified method. Some search methods ar

Bitstamp Security 7 May 29, 2022