Back to LanguageTool Homepage - Privacy - Imprint

Counting on grammatical error from many text files in a folder

Hi All,
I’m trying to use languagetool command recursively on a directory but it raised an error, anyone know why? this is the error that I got:
d:\LanguageTool>java -jar languagetool-commandline.jar -l en-US --recursive
Expected text language: English (US)
Exception in thread “main” java.lang.IllegalArgumentException: d:\LanguageTool- is not a directory, cannot use recursion
at org.languagetool.commandline.Main.runRecursive(
at org.languagetool.commandline.Main.main(

You need to specify the directory as a parameter, like this:

java -jar languagetool-commandline.jar -l en-US --recursive d:\LanguageTool
1 Like

Hi Daniel,
It works, however I can not separate the result for each text file, I use command:
java -jar languagetool-commandline.jar -l en-US --recursive d:\LanguageTool\input 1>result.txt

The big plan is I want to calculate every grammatical error found in each .txt file and analyse it in a spreadsheet. Is there any way to append the result in a .csv file? Or there is any other straightforward way to capture the count of grammatical error (for example from the Java Script)?

thx in advance

Just want to share, I do the workaround by applying DOS batch command to make a separated result.
Make a .bat file which consist of the following command for example:

java -jar languagetool-commandline.jar -l en-US username2.txt 1> LTusername2.txt
java -jar languagetool-commandline.jar -l en-US username73.txt 1> LTusername73.txt
java -jar languagetool-commandline.jar -l en-US username95.txt 1> LTusername95.txt

The next job is to import the result to a spreadsheet in a separated single cell and count the grammatical error for each txt file

useful link to import the result to excel spreadsheet

You could try using the --json parameter to get structured output (which you would then need to parse).

what is the best db to works with json? i do search a little and mongodb comes first, is it true?
btw my workaround with excel didn’t go well, excel truncated the text result when i try to import it using macro

I’ve tried mongodb and can not insert it into the database because the output seems like having a nested array, can you show me the way/url about how to parse it?