Package: textLSP
textLSPLanguage server for text spell and grammar check with various AI tools.This tool is in early development.FeaturesLSP featuresDiagnostics:spelling or grammatical errorsCode actions:Fix suggestionsAnalyze paragraph with a selected passive analyzer (if the analyzer does not check on save or change)ShowcaseOnly on the first character of the first line: analyze the whole document if it was not fully checked yetShowcaseCustom actions defined by a given analyzerE.g. OpenAI text generationContext based word suggestionShowcaseAnalyzersLocal toolsThe following tools run on the local system:LanguageTool: Mainly for development purposes, seeltex-lsfor a more mature implementation.Gramformer: Neural network based system.Gramformer needs to be installed manually:pip install git+https://github.com/PrithivirajDamodaran/Gramformer.githf_checker: Huggingfacetext2text-generationpipline based analyser. See theflan-t5-large-grammar-synthesismodel for an example.hf_completion: Huggingfacefill-maskpipline based text completion.Tools using remote servicesDISCLAIMER: 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!The following tools use remote text APIs.
Due to potential costs turning off automatic analysis if suggested.OpenAI: Supports text correction as well as text generation through a magic command in the text file.Generation showcaseGrammarBot: The GrammarBot API provides spelling and grammar checking.Supported File Typeslatexorgmarkdownany other file types as plain textSetupInstallpip install textLSPFor the latest version:pip install git+https://github.com/hangyav/textLSPRunningSimply run:textlspSince some analyzers are computation intensive, consider running it on a server using the TCP interface:textlsp --address 0.0.0.0 --port 1234or simply over ssh (with ssh key) if the client doesn't support it:ssh <server> textlspConfigurationUsing textLSP within an editor depends on the editor of choice.
For a few examples how to setup language servers in general in some of the popular editors seehereor take a look at the related documentation of your editor.By default all analyzers are disabled in textLSP, they have to be turned on in the settings.
Example configuration in lua for nvim (other editors should be set up accordingly):textLSP={analysers={languagetool={enabled=true,check_text={on_open=true,on_save=true,on_change=false,}},gramformer={-- gramformer dependency needs to be installed manuallyenabled=false,gpu=false,check_text={on_open=false,on_save=true,on_change=false,}},hf_checker={enabled=true,gpu=false,model='pszemraj/flan-t5-large-grammar-synthesis',-- model='pszemraj/grammar-synthesis-large',min_length=40,check_text={on_open=false,on_save=true,on_change=false,}},hf_completion={enabled=true,gpu=false,model='bert-base-multilingual-cased',topk=5,},openai={enabled=false,api_key='<MY_API_KEY>',check_text={on_open=false,on_save=false,on_change=false,},-- model = 'text-ada-001',model='text-babbage-001',-- model = 'text-curie-001',-- model = 'text-davinci-003',edit_model='text-davinci-edit-001',max_token=16,},grammarbot={enabled=false,api_key='<MY_API_KEY>',-- longer texts are split, this parameter sets the maximum number of splits per analysisinput_max_requests=1,check_text={on_open=false,on_save=false,on_change=false,}},},documents={org={org_todo_keywords={'TODO','IN_PROGRESS','DONE'},},txt={parse=true,},},}