https://github.com/manicmaniac/levenshtein.awk
https://github.com/manicmaniac/levenshtein.awk
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/manicmaniac/levenshtein.awk
- Owner: manicmaniac
- License: mit
- Created: 2015-03-15T10:32:35.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-12-04T16:40:36.000Z (over 6 years ago)
- Last Synced: 2025-01-24T20:23:56.664Z (4 months ago)
- Language: Shell
- Size: 73.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# levenshtein.awk
[](https://travis-ci.org/manicmaniac/levenshtein.awk)
An Awk library to measure the difference between 2 words.
## Compatibility
Any of POSIX Awk families.
includes:
- awk (one true Awk)
- nawk
- gawk
- igawk
- tawk## Usage
### `gawk` or `igawk`
Add this line in the top of your Awk program.
@include "levenshtein.awk"
### other `awk` families
Execute with `-f` option.
awk -f levenshtein_distance -f your_Awk_program
### API
levenshtein_distance(str1, str2)
- parameter `str1` is the string to compare.
- parameter `str2` is the other string to compare with `str1`.
- returns the cost to replace `str1` into `str2`.## Install
### `git`
git clone https://github.com/manicmaniac/levenshtein.awk
### `wget`
wget https://raw.githubusercontent.com/manicmaniac/levenshtein.awk/master/levenshtein.awk
### `curl`
curl https://raw.githubusercontent.com/manicmaniac/levenshtein.awk/master/levenshtein.awk > levenshtein.awk
Optional:
If you use `gawk`, you can set `$AWKPATH` environment variable.
AWKPATH="path/to/levenshtein.awk:$AWKPATH"
See [gawk's manual](https://www.gnu.org/software/gawk/manual/html_node/Include-Files.html) for more information.
## Testing
Before testing, you should install submodules.
git submodule init
git submodule updateThen run test.
./tests/test-runner.sh
## License
See [LICENSE.txt](LICENSE.txt).