Coder Social home page Coder Social logo

linter-languagetool's People

Contributors

dmohns avatar hesstobi avatar wysiib avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

linter-languagetool's Issues

linter-languagetool not picking up config file

The problem

I am running linter-languagetool with a locally installed languagetool server. I am trying to pass a config file to languagetool server using the settings interface of linter-languagetool.
However, linter-languagetool does not seem to respect the config file.

Actual behavior

For testing purposes I use the following .languagetool.cfg:

maxTextLength=1

However, languagetool server started by linter-languagetool will not consider this config file. For example, if I send a POST

➜ http POST http://localhost:8081/v2/check text=="I can't remember how to go their." language==en-US
HTTP/1.1 200 OK
Content-length: 436
Content-type: application/json
Date: Mon, 06 May 2019 13:05:53 GMT

{
    "language": {
        "code": "en-US",
        "detectedLanguage": {
            "code": "en-US",
            "confidence": 0.99999094,
            "name": "English (US)"
        },
        "name": "English (US)"
    },
    "matches": [],
    "software": {
        "apiVersion": 1,
        "buildDate": "2019-03-26 11:37",
        "name": "LanguageTool",
        "premium": false,
        "premiumHint": "You might be missing errors only the Premium version can find. Contact us at support<at>languagetoolplus.com.",
        "status": "",
        "version": "4.5"
    },
    "warnings": {
        "incompleteResults": false
    }
}

Expected behavior

Now, to remove the possibility of problems with the config file itself, I check top for what is actually run and run the server myself.

➜ /usr/bin/java -cp /usr/local/Cellar/languagetool/4.5/libexec/languagetool-server.jar org.languagetool.server.HTTPServer --port 8082 --config /Users/daniel/.languagetool.cfg

Resulting in the expected behavior

➜ http POST http://localhost:8082/v2/check text=="I can't remember how to go their." language==en-US
HTTP/1.1 413 Request Entity Too Large
Content-length: 102
Date: Mon, 06 May 2019 13:21:39 GMT

Error: Your text exceeds the limit of 1 characters (it's 33 characters). Please submit a shorter text.

Environment

OS: macOS 10.14.4
Atom: 1.36.1
linter-languagetool: 0.9.0
languagetool 4.5 (installed via brew)

Further comments

I am not very familiar with Atom plugins, but did some further testing/exploration by modifying linter-languagetool's sources files directly.
It looks like the problem is originating from here

ltoptions = ltoptions + ' --config ' + atom.config.get 'linter-languagetool.configFilePath'

and here

args: jvmoptions.concat ['-cp', ltjar, 'org.languagetool.server.HTTPServer', '--port', port, ltoptions]

If I modify it in a way that --config is passed hardcodedly via jvmoptions.concat the languagetool server correctly picks up the config file.

High cpu usage with long txt files

Hi, I use your plugin every day. It is great :). Unfortunately when I work with long text files language tool plugin consumes 100% cpu power. I guess it's because plugin (linter?) scans (checks) whole document at once, not just the new sentence. Is it possible to make same workaround and, for example, manually exclude some files from being linted? Maybe you've got other ideas? I would be grateful for any help.

Incorrectly says to end paragraph with a full stop in markdown

Suggests a full stop here ------------------------|
                                                  v
This is an example sentence in Markdown. Sentences
after a full stop which then flow on to a new line
results in a fullstop being wrongly suggested.

This does not happen when you flow onto a new line
without a fullstop on the line.

Not sure whether it's possible to work around this here. According to a LanguageTool maintainer, plugins like this should fix this issue:

danielnaber

I consider this out of scope for LT. Instead, editors should integrate LT and they should do the parsing of the text (markup vs. text, hand only the text to LT).

languagetool-org/languagetool#710

This is similar to #7 except this is about whitespace rather than about ignoring markup

Multiple Windows - Closing Initial Window Shuts Down Server

This is probably a pretty rare situation. I happened to have multiple windows open, and when I closed the original window, the LanguageTool service was shut down, causing errors on lint in the remaining opened windows.

I have some thoughts on how to address this, but my coffeescript / javascript / node skills are weak so not sure I could implement either of these.

  1. Create one instance of the LanguageTool service using a random available port for each window (i.e. each time the plugin is activated). Each window would have it's own service to use and shutdown on deactivate. The LanguageTool for Visual Studio Code plugin takes this approach. This would also eliminate the need for assigning a port value in the configuration.
  2. In the deactivate function, check to see if any other instances of linter-languagetool are running. If they are, leave the service running. Last one out turns off the lights, so to speak. I like this approach as it limits the amount of resources needed for LanguageTool.

Langauge Tool Port Conflict

I have two machines where port 8081 is already in use. I cannot change those existing services (work laptops). I'd like to add a configuration item for port, defaulting to 8081.

How to enable n-gram?

Would love some tips on how to use to find errors using n-gram data. I downloaded the data, and extraded it.

image

In the folder, there is an en/ folder. Is that correct? I don't see any additional suggestions compared to the online https://languagetool.org/ .. I would really love your input on this

Disable certain categories

If I understand correctly, at least the LanguageTool commandline allows to disable certain categories like checks for passive voice. Is it possible to retain this in the package?

Disable Rules and not entire Category of error.

If one wants to disable spelling mistakes, you can disable the TYPOS rule category but it will block any other rules in that category, e.g. N-Gram verification.

To fix that, and block only rule and not entire category, you can put, in your config file, which contains the path to you ngram dir, the path to another (!) config file with the list of rule you want to disable.

The first config file (you give its path to linter-languagetool in the settings) looks like this:

# Path to N-gram directory
languageModel=/Users/foo/bar/bin/ngrams
# Path to your disabled rules
rulesFile=/Users/foo/bar/bin/languagetool_rules.cfg

And the rulesFile looks like this, to solve the above mentioned problem:

# Disable rules for linter languagetool in Atom
disabledRules.en-US=MORFOLOGIK_RULE_EN_US

If the doc could be updated it would be nice for others, and this issue could be closed.

500 -

I'm receiving the following on Mac:

500 - "Error: Internal Error: java.lang.RuntimeException: Path /en/wrongWordInContext.txt not found in class path at /org/languagetool/rules/en/wrongWordInContext.txt"

I've tried using LanguageTool 4.1 via Homebrew, and manually downloading and unzipping LanguageTool 4.1 and 4.0 to local directories, all with the same results. Not seeing this on my Linux box.

Thoughts?

LanguageTool Still Running

On MacOS, the LanguageTool server continues to run after I shut down Atom. A quick look at the code says this is by design. Would it be possible to automatically shut down the server on close, or perhaps make it an option, or is there a specific reason not to do so?

JVM Memory Options / JAVA_OPTS

I'd like to either add two configuration items to control JVM memory consumption - -Xms and -Xms - set to reasonable defaults (like 256m and 512m) or possibly add a single configuration item with free-form jvm options like the JAVA_OPTS environment variable to give more control over how the language tool service runs.

Thoughts?

Do NOT use public API when local server cannot be startet

Configuration

linter-lnaguagetool set to user local server under /usr/share/java/languagetool/languagetool-server.jar
platform: Arch Linux

Observed behavior

Upon starting atom, I receive an error message that linter-languagetool was unable to start the local server and will thus default to use the public API. The linter continues to work with the external API.

Expected behavior

I am using Atom to write reports for my clients and sending the contents of a report that is considered confidential to an external API is absolutely out of the question. This is the precise reason I configured linter-languagetool to use a local server. If using this local server does not work for some reason, linter-languagetool should not use an public API unless explicitly instructed to do so.

One could argue, that the user is warned about this behavior, but the warning is only displayed for a few seconds so the fact that LT will use the public API might be missed by a user.

Uncaught SyntaxError: Unexpected token E in JSON at position 0

Hi, I got the following error when installing your package:

Step to reproduce:

  1. Install the package
  2. Start writting some text in a .tex file. The error does not occur in a .txt file.

Atom: 1.19.7 x64
Electron: 1.6.9
OS: Mac OS X 10.11.5
Thrown From: linter-languagetool package 0.5.0

Stack Trace

Uncaught SyntaxError: Unexpected token E in JSON at position 0

At file:///Applications/Atom.app/Contents/Resources/app/static/index.html:1

SyntaxError: Unexpected token E in JSON at position 0
    at JSON.parse (<anonymous>)
    at /packages/linter-languagetool/lib/linter-provider.coffee:103:29)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Commands

     -1:35.5.0 tree-view:show (atom-workspace.workspace.scrollbars-visible-when-scrolling)
  2x -1:01.3.0 linter-ui-default:toggle-panel (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-one-light-syntax.theme-one-light-ui)
     -0:42.3.0 core:backspace (input.hidden-input)
     -0:40.1.0 core:confirm (input.hidden-input)

Non-Core Packages

atom-beautify 0.30.5 
autocomplete-bibtex 0.7.0 
autocomplete-python 1.10.2 
busy-signal 1.4.3 
color-picker 2.2.5 
dictionary 0.5.0 
file-icons 2.1.11 
git-blame 1.2.2 
git-plus 7.9.3 
git-time-machine 1.5.9 
hyperclick 0.1.3 
indent-guide-improved 1.4.12 
intentions 1.1.5 
language-latex 1.1.1 
language-restructuredtext 1.1.0 
languagetool 0.1.1 
latex-autocomplete 1.0.0 
latex-completions 0.3.3 
latex-plus 0.9.1 
latexer 0.3.0 
latextools 0.8.5 
linter 2.2.0 
linter-chktex 1.3.1 
linter-just-say-no 0.7.3 
linter-languagetool 0.5.0 
linter-ui-default 1.6.8 
linter-write-good 0.9.0 
minimap 4.29.6 
pdf-view 0.59.0 
pigments 0.39.1 
project-manager 3.3.5 
rst-preview 1.3.1 
rst-preview-pandoc 0.1.12 
wordcount 2.10.4 
Zen 0.18.0 

Make languagetools only accessible on local loopback

Currently, the languagetools server is running in public mode. This is not needed as it only is access via the local loopback. This will prevent other people on the network using languagetools and reduce the risk of someone exploiting the open port.

Below is the code that includes the public parameter located here:

ltserver = child_process.exec 'java -cp ' + ltjar + ' org.languagetool.server.HTTPServer --public "$@"', (error, stdout, stderr) ->

Any possibility you could possibly keep this updated for pulsar, or we could fork it?

I'm from the group running Pulsar a fork of Atom and working to maintain it. While we're making updates to it, and we wanted to replace the functionality of the default spell checker with something more up to date. It seems plausible that this would be a suitable add-on to have whether it's still maintained by you and contributions come from interested users or if there's no problem with us forking it to use as a core add-on.

If it helps we also have a discord you can join since we're trying to build up our native add-ons that aren't just backups of the old Atom ones. I'll attach a link to that below (and hope this doesn't seem to out of place making this issue here and that you don't consider it to be spam somehow)

https://discord.gg/7aEbB9dGRT

Improve Markup Language Support

This linter is doing a great job. In case of writing a document with markup language like LaTeX it could be improved, because is shows errors on every latex command. As a quick and dirty solution a add following lines:

  editorContent = editorContent.replace /(\\\w+)((?:\{[^\}]*\})*)((?:\[[^\]]*\])*)((?:\{[^\}]*\})*)/g , (match, name, group1, group2, group3, index, input) ->
    if /\\(\w*section|\w*caption|text\w*|mbox)/.test(name)
      output = Array(name.length+1).join(" ") +
        group1.replace(/[\{\}]/g, " ") +
        Array(group2.length+1).join(" ") +
        group3.replace(/[\{\}]/g, " ")
    else
      output = Array(match.length+1).join " "
    return output

Which replacing the large part of the LaTeX markup with spaces. I than disabled the WHITESPACE_RULE
A more general approach would be to ignore grammar scopes and pattern with an API like linter-spell is providing.

add a way to ignore specific words like names and code snippets

When writing a document and adding code snippets or names, linter-languagetool marks those as lint errors.

so, for example, if I'm writing a markdown file, I can get an error on this text:

## gerrit
you can assign code reviewers on gerrit by going to `gerrit-owners-autoassign`

the name gerrit is a small probelm since I can always write it in Title case.
The problem is with the code snippet. I can't set the linter-languagetool to ignore text wrapped in something or add words to the ignore list

tell me if you have plans on implementing this (or if you want me to send you a pull request for this feature)

How to use n-gram dataset ?

Hi!

I downloaded the n-gram dataset, and put it in a directory like this: /path/to/dir/en/ which contains 3 folders: 1grams, 2grams, 3grams, and put the path /path/to/dir/ into the field "Path to the n-gram directory".

I manage to make it work with the standalone version (languagetool.jar) but not on Atom.
I restarted atom but it did not work either.

I have Atom 1.20.0 and linter-languagetool v0.5.2

Thanks

support local server

the public languagetool api is limited. the linter should support a local server

Uncaught SyntaxError: Unexpected token < in JSON at position 0

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.15.0 x64
Electron: 1.3.13
OS: Debian GNU/Linux
Thrown From: linter-languagetool package 0.4.0

Stack Trace

Uncaught SyntaxError: Unexpected token < in JSON at position 0

At file:///usr/share/atom/resources/app.asar/static/index.html:1

SyntaxError: Unexpected token < in JSON at position 0
    at Object.parse (native)
    at /packages/linter-languagetool/lib/linter-provider.coffee:65:29)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Commands

     -1:26.6.0 tree-view:show (atom-workspace.workspace.scrollbars-visible-always.theme-base16-tomorrow-dark-theme.theme-one-dark-ui)
     -0:58.7.0 intentions:highlight (input.hidden-input)
     -0:58.2.0 find-and-replace:show (input.hidden-input)
  2x -0:32.5.0 core:backspace (input.hidden-input)

Non-Core Packages

atom-beautify 0.29.18 
atom-css-comb 3.1.0 
atom-htmltidy 5.1.0 
atom-prettify 0.1.3 
atom-python-run 0.7.3 
atom-toolbar 0.1.6 
auto-detect-indentation 1.3.0 
auto-indent 0.5.0 
autoclose-html 0.23.0 
autocomplete-python 1.8.63 
bracket-close-jump 0.1.2 
busy-signal 1.3.0 
case-switch 2.2.4 
change-case 0.6.5 
close-tags 0.6.0 
color-picker 2.2.5 
drag-drop-text 0.1.4 
file-icons 2.1.2 
flex-tool-bar 0.12.0 
highlight-selected 0.13.1 
intentions 1.1.2 
language-markdown 0.20.0 
lines 0.13.1 
linkify 0.11.0 
linter 2.1.2 
linter-languagetool 0.4.0 
linter-php 1.3.2 
linter-python 3.1.1 
linter-spell-html 0.6.2 
linter-ui-default 1.2.2 
markdown-assistant 0.2.0 
markdown-helpers 0.3.0 
markdown-pdf 1.5.0 
markdown-preview-enhanced 0.10.12 
markdown-preview-plus 2.4.9 
markdown-themeable-pdf 1.2.0 
markdown-toc 0.4.2 
markdown-toolbar 0.1.2 
markdown-writer 2.6.4 
minimap 4.27.1 
minimap-highlight-selected 4.6.1 
minimap-pigments 0.2.2 
open-in-browser 0.5.0 
open-recent 5.0.0 
pandoc-convert 1.1.0 
php-cs-fixer 4.1.0 
pigments 0.39.1 
pretty-json 1.6.3 
print-code 0.6.0 
python-debugger 0.2.0 
python-indent 1.0.2 
python-tools 0.6.9 
simple-drag-drop-text 0.3.4 
smart-quotes-plus 2.1.0 
smarter-delete-line 1.1.2 
spell-check-project 0.7.0 
tag 0.4.0 
text-manipulation 0.6.0 
tidy-markdown 3.0.1 
title-case 0.4.0 
tool-bar 1.1.0 
tool-bar-config 0.1.0 
tool-bar-main 0.0.10 
tool-bar-markdown-writer 0.2.0 
toolbar-iconshortcuts 3.10.0 
trailing-spaces 0.4.0 
url-utils 0.2.1 
wordcount 2.10.4 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.