{"id":15520728,"url":"https://github.com/proycon/sesdiff","last_synced_at":"2025-06-25T03:45:02.898Z","repository":{"id":57667039,"uuid":"287499062","full_name":"proycon/sesdiff","owner":"proycon","description":"Generates a shortest edit script (Myers' diff algorithm) to indicate how to get from the strings in column A to the strings in column B. Also provides the edit distance (levenshtein).","archived":false,"fork":false,"pushed_at":"2024-10-15T08:58:20.000Z","size":78,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T04:09:10.480Z","etag":null,"topics":["diff","levenshtein","nlp","shortest-edit-script"],"latest_commit_sha":null,"homepage":"https://git.sr.ht/~proycon/sesdiff","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/proycon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-14T09:45:45.000Z","updated_at":"2025-02-07T10:00:22.000Z","dependencies_parsed_at":"2024-11-08T20:02:57.401Z","dependency_job_id":"29c6d6ac-a0f1-473d-a9f8-e79a757c5a9c","html_url":"https://github.com/proycon/sesdiff","commit_stats":{"total_commits":30,"total_committers":1,"mean_commits":30.0,"dds":0.0,"last_synced_commit":"531fbbcf88393dd607308d663b2053f74578772c"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proycon%2Fsesdiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proycon%2Fsesdiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proycon%2Fsesdiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proycon%2Fsesdiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proycon","download_url":"https://codeload.github.com/proycon/sesdiff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250366721,"owners_count":21418772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diff","levenshtein","nlp","shortest-edit-script"],"created_at":"2024-10-02T10:29:07.764Z","updated_at":"2025-04-23T04:09:18.244Z","avatar_url":"https://github.com/proycon.png","language":"Rust","funding_links":[],"categories":["\u003ca name=\"diff\"\u003e\u003c/a\u003eDiff"],"sub_categories":[],"readme":"[![Crate](https://img.shields.io/crates/v/sesdiff.svg)](https://crates.io/crates/sesdiff)\n[![GitHub build](https://github.com/proycon/sesdiff/actions/workflows/sesdiff.yml/badge.svg?branch=master)](https://github.com/proycon/sesdiff/actions/)\n[![GitHub release](https://img.shields.io/github/release/proycon/sesdiff.svg)](https://GitHub.com/proycon/sesdiff/releases/)\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n\n# sesdiff: Shortest Edit Script Diff\n\n## Description\n\nThis is a small and fast command line tool and Rust library that reads a two-column tab separated input from standard input and computes the shortest edit script (Myers' diff algorithm) to go from the string in column A to the string in column B. It also computes the edit distance (aka levenshtein distance).\n\nThere is also a [python binding](python/) available if you want to use sesdiff\nfrom Python. The documentation here covers the command-line version.\n\nIt was written to build lemmatisers.\n\n## Installation\n\nInstall it using Rust's package manager:\n\n```\ncargo install sesdiff\n```\n\nNo cargo/rust on your system yet? Do ``sudo apt install cargo`` on Debian/ubuntu based systems, ``brew install rust`` on mac, or use [rustup](https://rustup.rs/).\n\nThis tool builds upon [Dissimilar](https://crates.io/crates/dissimilar) that provides the actual diff algorithm (will be\ndownloaded and compiled in automatically).\n\n## Usage\n\n```\n$ sesdiff \u003c input.tsv\n```\n\nExample input and output (reformatted for legibility, the first two columns correspond to the input). Output is in a four-column tab separated format:\n\n```\nhablaron        hablar     =[hablar]-[on]                  2\ncontaron        contar     =[contar]-[on]                  2\npidieron        pedir      =[p]-[i]+[e]=[di]-[eron]+[r]    6\nговорим         говорить   =[говори]-[м]+[ть]              3\n```\n\nBy default the full edit script will be provided in a simple language:\n\n* ``=[]`` - The text between brackets is identical in strings A and B\n    * ``=[#n]`` - If you use the ``--abstract`` parameter, this will be used instead, where ``n`` represents a number\n      indicating the length of text between  that is identical in strings A and B\n* ``-[]`` - The text between brackets is removed to get to string B\n* ``+[]`` - The text between brackets is added to get to string B\n\nFor lemmatisation purposes, it makes sense for many languages to look at\nsuffixes (from right to left) and strip common prefixes. Pass the ``--suffix``\noption for that behaviour and output is now:\n\n```\n$ sesdiff --suffix \u003c input.tsv\nhablaron        hablar          -[on]                      2\ncontaron        contar          -[on]                      2\npidieron        pedir           -[eron]+[r]=[di]-[i]+[e]   6\nговорим         говорить        -[м]+[ть]                  3\n```\n\nNote that the edit scripts in suffix mode are formulated differently than in normal mode (they start from the right\ntoo). There is also a ``--prefix`` option that strips common suffixes.\n\nUse the ``--abstract`` parameter to get a slightly more abstract edit script that refers to the length of unchanged parts\nrather than their contents. You would then get:\n\n```\npidieron        pedir           -[eron]+[r]=[#2]-[i]+[e]   6\n```\n\nSesdiff can also apply edit scripts to our input, use the ``--apply`` flag and feed the tool tab separated input with\na string in the first column and an edit script in the second, as in the the following example ``input2.tsv``:\n\n```\n$ cat input2.tsv\npidieron        -[eron]+[r]=[di]-[i]+[e]\n```\n\nRun sesdiff as follows and a third column will be added with the solution:\n\n```\n$ sesdiff --suffix --apply \u003c input2.tsv\npidieron        -[eron]+[r]=[di]-[i]+[e]                pedir\n```\n\nWhen using ``--apply``, you can also make use of an extra ``--infix`` parameter to indicate that an edit script must be\nattempted to be matched with any infix in the string, including multiple. Consider the following example that replaces\nall letters *a* with *o*:\n\n```\n$ cat input3.tsv\nhahaha       -[a]+[o]\n\n$ sesdiff --infix --apply \u003c input3.tsv\nhahaha       -[a]+[o]\thohoho\n```\n\nIn ``--apply`` mode, you can also make edit scripts applicable to multiple patterns by using the ``|`` operator. This is\nonly allowed for deletions (``-[]``) and equality checks (``=[]``):\n\n```\n$ cat input4.tsv\nhihaho       -[a|i|o]+[e]\n\n$ sesdiff --infix --apply \u003c input4.tsv\nhihaho       -[a|i|o]+[e]\thehehe\n```\n\n# License\n\nGNU General Public Licence v3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproycon%2Fsesdiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproycon%2Fsesdiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproycon%2Fsesdiff/lists"}