This package contains Greedy String Tiling calculation
Project description
GST Calculation
GST is a module that calculates Greedy String Tiling algorithm as described in "String Similarity via Greedy String Tiling and Running Karp−Rabin Matching" (Wise, 1993) - https://www.researchgate.net/publication/262763983_String_Similarity_via_Greedy_String_Tiling_and_Running_Karp-Rabin_Matching
Installation
Using PIP via PyPI
pip install gst-calculation
Using PIP via Github
pip install git+https://github.com/tomytw/gst-calculation.git@0.1.2
Usage
Importing the package
>>> from gst_calculation import gst
You can calculate a gst of a collection of numbers or strings (or any collection of object that can be compared using equal function, must have __eq__ method inside it's class)
The result will be array that contains two elements (two index):
- Tile information (position and length of matched tiles)
- Total score
GST on Numbers List
>>> tokens_sequence_1 = [1,2,3,4,5]
>>> tokens_sequence_2 = [3,4,5,6,7]
>>> gst.calculate(tokens_sequence_1, tokens_sequence_2, minimal_match=3)
[[{'token_1_position': 2, 'token_2_position': 0, 'length': 3, 'score': 3}], 3]
GST on Strings List
>>> tokens_sequence_1 = ['the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog']
>>> tokens_sequence_2 = ['the', 'lazy', 'dog', 'jumps', 'over', 'the', 'quick', 'brown', 'fox']
>>> gst.calculate(tokens_sequence_1, tokens_sequence_2, minimal_match=3)
[[{'token_1_position': 0, 'token_2_position': 5, 'length': 4, 'score': 4},
{'token_1_position': 6, 'token_2_position': 0, 'length': 3, 'score': 3}],
7]
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file gst_calculation-0.1.2.tar.gz
.
File metadata
- Download URL: gst_calculation-0.1.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da77a08f81db960ecea5b110ef18d53637abab42e24231631ceaaa23ba683b68 |
|
MD5 | fe087d1177edb2d9260247e62fed2e97 |
|
BLAKE2b-256 | 7dcd1b2b2f8a4c62274de0eaef2c389dbcfdccdb7ca41da87e3aa59cf1b93108 |
File details
Details for the file gst_calculation-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: gst_calculation-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63160ea3a14b07922bb333b0b09441d8180542ba98a2d3be7fbe7947cf4defe8 |
|
MD5 | f4f959e92f97d8107b139a60ed93730a |
|
BLAKE2b-256 | 38892003384eebe14e652caf5cbf9916c755b9b130dd09a136b3841eeaca8a88 |