{"id":13897152,"url":"https://github.com/hangyav/textLSP","last_synced_at":"2025-07-17T14:30:27.294Z","repository":{"id":65960314,"uuid":"567642886","full_name":"hangyav/textLSP","owner":"hangyav","description":"Language server for text spell and grammar check with various tools.","archived":false,"fork":false,"pushed_at":"2025-06-07T05:45:11.000Z","size":422,"stargazers_count":76,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-26T03:40:21.078Z","etag":null,"topics":["artificial-intelligence","grammar-checker","language-server","language-server-protocol","latex","org-mode","pygls","spellchecker"],"latest_commit_sha":null,"homepage":"","language":"Python","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/hangyav.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,"zenodo":null}},"created_at":"2022-11-18T08:37:17.000Z","updated_at":"2025-06-19T09:43:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"5b09d059-1711-42ea-8153-cd61f167527e","html_url":"https://github.com/hangyav/textLSP","commit_stats":{"total_commits":137,"total_committers":5,"mean_commits":27.4,"dds":0.5328467153284672,"last_synced_commit":"a1b277728e63c780206fa11ffd1c5288599c8760"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/hangyav/textLSP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hangyav%2FtextLSP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hangyav%2FtextLSP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hangyav%2FtextLSP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hangyav%2FtextLSP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hangyav","download_url":"https://codeload.github.com/hangyav/textLSP/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hangyav%2FtextLSP/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265616499,"owners_count":23798845,"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":["artificial-intelligence","grammar-checker","language-server","language-server-protocol","latex","org-mode","pygls","spellchecker"],"created_at":"2024-08-06T18:03:23.177Z","updated_at":"2025-07-17T14:30:26.924Z","avatar_url":"https://github.com/hangyav.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# textLSP\n\nLanguage server for text spell and grammar check with various AI tools.\n\n_This tool is in early development._\n\n![textLSP](https://user-images.githubusercontent.com/414596/219856412-8095caa5-9ce6-49fe-9713-78d234837ac4.png)\n\n## Features\n\n### LSP features\n\n* Diagnostics:\n    * spelling or grammatical errors\n* Code actions:\n    * Fix suggestions\n    * Analyze paragraph with a selected passive analyzer (if the analyzer does not check on save or change)\n        \u003cdetails\u003e\u003csummary\u003eShowcase\u003c/summary\u003e\n           \u003cimg src=\"https://user-images.githubusercontent.com/414596/219856438-0810eb43-929c-4bc3-811e-2ab53a5b2ae3.gif\" height=80% width=80%/\u003e\n        \u003c/details\u003e\n    * Only on the first character of the first line: analyze the whole document if it was not fully checked yet\n        \u003cdetails\u003e\u003csummary\u003eShowcase\u003c/summary\u003e\n           \u003cimg src=\"https://user-images.githubusercontent.com/414596/219856461-406c1e8f-ef71-4b6d-9270-6955320bd6aa.gif\" height=80% width=80%/\u003e\n        \u003c/details\u003e\n    * Custom actions defined by a given analyzer\n      \u003cdetails\u003e\u003csummary\u003eE.g. OpenAI text generation\u003c/summary\u003e\n        \u003cimg src=\"https://user-images.githubusercontent.com/414596/219856479-b85b5c2d-6158-44be-9063-12254b76e39c.gif\" height=80% width=80%/\u003e\n      \u003c/details\u003e\n* Context based word suggestion\n   \u003cdetails\u003e\u003csummary\u003eShowcase\u003c/summary\u003e\n      \u003cimg src=\"https://user-images.githubusercontent.com/414596/225412142-0cd83321-4a8e-47cf-8b5a-2cec4193800d.gif\" height=80% width=80%/\u003e\n   \u003c/details\u003e\n\n## Analyzers\n\n### Local tools\n\nThe following tools run on the local system:\n\n* [LanguageTool](https://languagetool.org): Mainly for development purposes, see [ltex-ls](https://github.com/valentjn/ltex-ls) for a more mature implementation.\n* [Ollama](https://www.ollama.com): Run LLMs efficiently on your local machine.\n        It supports diagnostics, code actions and prompt based text generation.\n    * Ollama needs to be [installed manually](https://www.ollama.com/download) first.\n    * Various [LLMs](https://www.ollama.com/library) are supported, such as `Llama 3`, `Gemma` or `Mixtra`. Suggested model is `Phi3`, due to its speed, size and accuracy.\n* hf_checker: Huggingface `text2text-generation` pipeline based analyser. See the [flan-t5-large-grammar-synthesis](https://huggingface.co/pszemraj/flan-t5-large-grammar-synthesis) model for an example.\n   \u003cdetails\u003e\u003csummary\u003eModels\u003c/summary\u003e\n      \u003cul\u003e\n       \u003cli\u003epszemraj/grammar-synthesis-small\u003c/li\u003e\n       \u003cli\u003epszemraj/grammar-synthesis-large\u003c/li\u003e\n       \u003cli\u003epszemraj/flan-t5-large-grammar-synthesis\u003c/li\u003e\n       \u003cli\u003epszemraj/flan-t5-xl-grammar-synthesis\u003c/li\u003e\n       \u003cli\u003epszemraj/bart-base-grammar-synthesis\u003c/li\u003e\n      \u003c/ul\u003e\n   \u003c/details\u003e\n* hf_instruction_checker: Huggingface `text2text-generation` pipeline based\nanalyser using instruction tuned models. See the Grammarly's\n[CoEdIT](https://github.com/vipulraheja/coedit) model for an example. Supports\nerror checking and text generation, such as paraphrasing, through the `%HF%`\nmagic command (see the OpenAI analyser below).\n   \u003cdetails\u003e\u003csummary\u003eModels\u003c/summary\u003e\n      \u003cul\u003e\n       \u003cli\u003egrammarly/coedit-large\u003c/li\u003e\n       \u003cli\u003egrammarly/coedit-xl\u003c/li\u003e\n       \u003cli\u003egrammarly/coedit-xl-composite\u003c/li\u003e\n       \u003cli\u003egrammarly/coedit-xxl\u003c/li\u003e\n       \u003cli\u003ejbochi/coedit-base\u003c/li\u003e\n       \u003cli\u003ejbochi/coedit-small\u003c/li\u003e\n       \u003cli\u003ejbochi/candle-coedit-quantized\u003c/li\u003e\n      \u003c/ul\u003e\n   \u003c/details\u003e\n* [hf_completion](https://huggingface.co/docs/transformers/task_summary#language-modeling): Huggingface `fill-mask` pipeline based text completion.\n* [Gramformer](https://github.com/PrithivirajDamodaran/Gramformer): Neural network based system.\n\n### Tools using remote services\n\n**DISCLAIMER: THE RELATED APIS REQUIRE REGISTRATION AND ARE NOT FREE TO USE! USE THESE ANALYZERS ON YOUR OWN RESPONSIBILITY! THE AUTHORS OF TEXTLSP DO NOT ASSUME ANY RESPONSIBILITY FOR THE COSTS INCURRED!**\n\nThe following tools use remote text APIs.\nDue to potential costs turning off automatic analysis if suggested.\n\n* [OpenAI](https://openai.com/api): Supports text correction as well as text generation through a magic command in the text file.\n  * A custom URL can be set to use an OpenAI-compatible server. See the example\n        [configuration](#configuration) below.\n\n    \u003cdetails\u003e\u003csummary\u003eGeneration showcase\u003c/summary\u003e\n        \u003cimg src=\"https://user-images.githubusercontent.com/414596/219856479-b85b5c2d-6158-44be-9063-12254b76e39c.gif\" height=80% width=80%/\u003e\n    \u003c/details\u003e\n* [GrammarBot](https://rapidapi.com/grammarbot/api/grammarbot): The GrammarBot API provides spelling and grammar checking.\n\n## Supported File Types\n\n* latex\n* org\n* markdown\n* any other file types as plain text\n\n## Setup\n\n### Install\n```\npip install textLSP\n```\n\nFor the latest version:\n```\npip install git+https://github.com/hangyav/textLSP\n```\n\n#### Additional dependencies\nSome analyzers need additional dependencies!\n\n* hf_checker, hf_instruction_checker and hf_completion:\n```\npip install textLSP[transformers]\n```\n\n* Gramformer needs to be installed manually:\n```\npip install git+https://github.com/PrithivirajDamodaran/Gramformer.git\n```\n\n### Running\nSimply run:\n```\ntextlsp\n```\n\nSince some analyzers are computation intensive, consider running it on a server using the TCP interface:\n```\ntextlsp --address 0.0.0.0 --port 1234\n```\nor simply over ssh (with ssh key) if the client doesn't support it:\n```\nssh \u003cserver\u003e textlsp\n```\n\n### Configuration\n\nUsing textLSP within an editor depends on the editor of choice.\nFor a few examples how to set up language servers in general in some of the popular editors see [here](https://github.com/openlawlibrary/pygls/tree/master/examples/hello-world#editor-configurations) or take a look at the related documentation of your editor.\n\nBy default, all analyzers are disabled in textLSP, they have to be turned on in the settings.\nExample configuration in lua for nvim (other editors should be set up accordingly):\n\n```lua\ntextLSP = {\n    analysers = {\n        languagetool = {\n            enabled = true,\n            check_text = {\n                on_open = true,\n                on_save = true,\n                on_change = false,\n            }\n        },\n        ollama = {\n          enabled = true,\n          check_text = {\n            on_open = false,\n            on_save = true,\n            on_change = false,\n          },\n          model = \"phi3:3.8b-instruct\",  -- smaller but faster model\n          -- model = \"phi3:14b-instruct\",  -- more accurate\n          max_token = 50,\n        },\n        gramformer = {\n            -- gramformer dependency needs to be installed manually\n            enabled = false,\n            gpu = false,\n            check_text = {\n                on_open = false,\n                on_save = true,\n                on_change = false,\n            }\n        },\n        hf_checker = {\n            enabled = false,\n            gpu = false,\n            quantize=32,\n            model='pszemraj/flan-t5-large-grammar-synthesis',\n            min_length=40,\n            check_text = {\n                on_open = false,\n                on_save = true,\n                on_change = false,\n            }\n        },\n        hf_instruction_checker = {\n            enabled = false,\n            gpu = false,\n            quantize=32,\n            model='grammarly/coedit-large',\n            min_length=40,\n            check_text = {\n                on_open = false,\n                on_save = true,\n                on_change = false,\n            }\n        },\n        hf_completion = {\n            enabled = false,\n            gpu = false,\n            quantize=32,\n            model='bert-base-multilingual-cased',\n            topk=5,\n        },\n        openai = {\n            enabled = false,\n            api_key = '\u003cMY_API_KEY\u003e',\n            -- url = '\u003cCUSTOM_URL\u003e'  -- optional to use an OpenAI-compatible server\n            check_text = {\n                on_open = false,\n                on_save = false,\n                on_change = false,\n            },\n            model = 'gpt-3.5-turbo',\n            max_token = 16,\n        },\n        grammarbot = {\n            enabled = false,\n            api_key = '\u003cMY_API_KEY\u003e',\n            -- longer texts are split, this parameter sets the maximum number of splits per analysis\n            input_max_requests = 1,\n            check_text = {\n                on_open = false,\n                on_save = false,\n                on_change = false,\n            }\n        },\n    },\n    documents = {\n        -- the language of the documents, could be set to `auto` of `auto:\u003cfallback\u003e`\n        -- to detect automatically, default: auto:en\n        language = \"auto:en\",\n        -- do not autodetect documents with fewer characters\n        min_length_language_detect = 20,\n        org = {\n            org_todo_keywords = {\n                'TODO',\n                'IN_PROGRESS',\n                'DONE'\n            },\n        },\n        txt = {\n            parse = true,\n        },\n    },\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhangyav%2FtextLSP","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhangyav%2FtextLSP","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhangyav%2FtextLSP/lists"}