{"id":17327003,"url":"https://github.com/vmarkovtsev/go-lcss","last_synced_at":"2025-04-14T17:30:49.834Z","repository":{"id":57484316,"uuid":"153935893","full_name":"vmarkovtsev/go-lcss","owner":"vmarkovtsev","description":"Fast Longest Common Substring in Go","archived":false,"fork":false,"pushed_at":"2018-10-22T05:59:12.000Z","size":27,"stargazers_count":44,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-19T22:13:21.633Z","etag":null,"topics":["longest-common-substring"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vmarkovtsev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-20T18:29:18.000Z","updated_at":"2024-03-02T19:39:43.000Z","dependencies_parsed_at":"2022-08-26T12:24:51.546Z","dependency_job_id":null,"html_url":"https://github.com/vmarkovtsev/go-lcss","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmarkovtsev%2Fgo-lcss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmarkovtsev%2Fgo-lcss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmarkovtsev%2Fgo-lcss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmarkovtsev%2Fgo-lcss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmarkovtsev","download_url":"https://codeload.github.com/vmarkovtsev/go-lcss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219843706,"owners_count":16556502,"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":["longest-common-substring"],"created_at":"2024-10-15T14:18:18.345Z","updated_at":"2024-10-15T14:18:19.082Z","avatar_url":"https://github.com/vmarkovtsev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"logo.png\" alt=\"go-lcss logo\"\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003ego-lcss\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n      Fast Longest Common Substring algorithm in Go.\u003cbr\u003e\u003cbr\u003e\n      \u003ca href=\"http://godoc.org/gopkg.in/vmarkovtsev/go-lcss.v1\"\u003e\u003cimg src=\"https://godoc.org/gopkg.in/vmarkovtsev/go-lcss.v1?status.svg\" alt=\"GoDoc\"\u003e\u003c/a\u003e\n      \u003ca href=\"https://travis-ci.org/vmarkovtsev/go-lcss\"\u003e\u003cimg src=\"https://travis-ci.org/vmarkovtsev/go-lcss.svg?branch=master\" alt=\"Travis build Status\"\u003e\u003c/a\u003e\n      \u003ca href=\"https://codecov.io/gh/vmarkovtsev/go-lcss\"\u003e\u003cimg src=\"https://codecov.io/github/vmarkovtsev/go-lcss/coverage.svg\" alt=\"Code coverage\"\u003e\u003c/a\u003e\n      \u003ca href=\"https://goreportcard.com/report/github.com/vmarkovtsev/go-lcss\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/vmarkovtsev/go-lcss\" alt=\"Go Report Card\"\u003e\u003c/a\u003e\n      \u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"Apache 2.0 license\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#overview\"\u003eOverview\u003c/a\u003e •\n  \u003ca href=\"#how-to-use\"\u003eHow To Use\u003c/a\u003e •\n  \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e •\n  \u003ca href=\"#contributions\"\u003eContributions\u003c/a\u003e •\n  \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n--------\n\n## Overview\n\n[Longest Common Substring](https://en.wikipedia.org/wiki/Longest_common_substring_problem)\n(don't confuse with Longest Common Subsequence) is\na well-known computer science problem of finding the longest substring which appears in all\nthe given strings. It can be efficiently solved in log-linear time and linear space.\nThe implemented algorithm uses the code to build [suffix arrays](https://en.wikipedia.org/wiki/Suffix_array)\nwhich was copy-pasted from the Go's standard library - it\nis internal to `index/suffixarray` and unfortunately cannot be invoked directly.\nThere is a [blog post](https://www.roman10.net/2012/03/16/suffix-array-part-3-longest-common-substring-lcs/)\nwhich gives some general understanding of that algorithm, though the actual implementation is quite different\n(and optimized).\n\n## How To Use\n\nThere are two functions: \"basic\" and \"advanced\". The former is straightforward:\n\n```go\nimport \"gopkg.in/vmarkovtsev/go-lcss.v1\"\n\nlcss.LongestCommonSubstring([]byte(\"ABABC\"), []byte(\"BABCA\"), []byte(\"ABCBA\"))\n// []byte(\"ABC\")\n```\n\nThe \"advanced\" function allows to cache the suffix arrays. It can be useful since the construction\nof suffix arrays dominates over the run time of the algorithm:\n\n```go\n\nimport \"gopkg.in/vmarkovtsev/go-lcss.v1\"\n\ns1, s2, s3 := []byte(\"ABABC\"), []byte(\"BABCA\"), []byte(\"ABCBA\")\nlcss.LongestCommonSubstringWithSuffixArrays(\n\t[][]byte{s1, s2, s3},\n\t[][]int{lcss.Qsufsort(s1), lcss.Qsufsort(s2), lcss.Qsufsort(s3)})\n// []byte(\"ABC\")\n```\n\n## Installation\n\n```\ngo get gopkg.in/vmarkovtsev/go-lcss.v1\n```\n\nThe code supports building under Go \u003e= 1.8.\n\n## Contributions\n\n...are pretty much welcome! See [contributing.md](contributing.md) and [code_of_conduct.md](code_of_conduct.md).\n\n## License\n\nApache 2.0, see [LICENSE](LICENSE). It allows you to use this code in proprietary projects.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmarkovtsev%2Fgo-lcss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmarkovtsev%2Fgo-lcss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmarkovtsev%2Fgo-lcss/lists"}