Skip to content

Commit

Permalink
Merge pull request #13 from hesstobi/ngram
Browse files Browse the repository at this point in the history
Add option for to set the n-gram path for the local server to enable …
  • Loading branch information
wysiib authored Jun 20, 2017
2 parents cd52c73 + 5486a9f commit 605f8c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/linter-languagetool.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ module.exports = LinterLanguagetool =
description: 'If given, the linter tries to start a local languagetool server and connect to it. If left blank, the public languagetool API is used instead.'
type: 'string'
default: ''
nGramDataPath:
title: 'Path to the n gram directory'
description: 'If given LanguageTool can etect errors with words that are often confused, like *their* and *there*. See [LanguageTool Wiki](http://wiki.languagetool.org/finding-errors-using-n-gram-data) for more information'
type: 'string'
default: ''
grammerScopes:
type: 'array'
description: 'This preference holds a list of grammar scopes languagetool should be applied to.'
Expand Down
5 changes: 4 additions & 1 deletion lib/linter-provider.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ module.exports = class LinterProvider
startserver = ->
if server_started is false
server_started = true
ltoptions = ''
if atom.config.get 'linter-languagetool.nGramDataPath'
ltoptions = ltoptions + ' --languageModel ' + atom.config.get 'linter-languagetool.nGramDataPath'
ltjar = atom.config.get 'linter-languagetool.languagetoolServerPath'
ltserver = child_process.exec 'java -cp ' + ltjar + ' org.languagetool.server.HTTPServer --public "$@"', (error, stdout, stderr) ->
ltserver = child_process.exec 'java -cp ' + ltjar + ' org.languagetool.server.HTTPServer ' + ltoptions + ' --public "$@" ', (error, stdout, stderr) ->
if error
console.error error
console.log stdout
Expand Down

0 comments on commit 605f8c2

Please sign in to comment.