Back to LanguageTool Homepage - Privacy - Imprint

Rules for Markdown


(Steph) #1

Hello!

i would like check markdown files; it works pretty well but LG mark the markdown tags as a failure! That is clear because LG has no rules of that?

Now i would like to write some rules; but i did not now how is the best strategy for that:

1.) Implement the rules in a existing rule set of a language?
2.) Implement a own rule set for Markdown and use the bi-mode?

What are you think?

thx,
steph


(Daniel Naber) #2

LT only works on plain text, so you'll need to either convert Markdown to plain text first, or tell LT what the markup is. As a developer, you can do that using https://languagetool.org/development/api/org/languagetool/markup/AnnotatedTextBuilder.html.

Writing "rules" always refers to detecting errors in natural language text, this has nothing to do with the format (Markdown, LaTeX etc.) of the text.


(Steph) #3

Ok - that make sense!

I'm not really a Java developer but i would familiarize myself though the LG-Dev., if someone can help me by the first steps?

I need a skeleton code snippet?


(Daniel Naber) #4

A simple example of checking plain text can be found at http://wiki.languagetool.org/java-api. Instead of plain text, you'd need to pass in AnnotatedText, created with the AnnotatedTextBuilder, as mentioned. Anyway, it's still up to you to actually find out what's markup and what's text.

Feel free to ask questions here or on our mailing list (we won't be able to provide general help with Java, though).


(Steph) #5

Puhhhh - i run in a compiling problem?

What i do:

1.) Get the source from git
2.) Install Oracle Java-JDK-8
3.) Install maven2 / Ubuntu 14.04
4.) i call: mvn clean package in the root of source
5.) then i call: ./build.sh languagetool-standalone clean package

It seems to be that some LanguageTool files from oss.sonatype.org fails. I take a look and yes - there are only files in Version 2.3? And now; is it possible to easy rename this files to 2.7?

Failure-Diskription:


[INFO] ------------------------------------------------------------------------
[INFO] Building English module for LanguageTool
[INFO] task-segment: [test]
[INFO] ------------------------------------------------------------------------
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/languagetool/languagetool-core/2.7-SNAPSHOT/languagetool-core-2.7-SNAPSHOT-tests.jar
[INFO] Unable to find resource 'org.languagetool:languagetool-core:test-jar:tests:2.7-SNAPSHOT' in repository sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:

1) org.languagetool:languagetool-core:test-jar:tests:2.7-SNAPSHOT

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.languagetool -DartifactId=languagetool-core -Dversion=2.7-SNAPSHOT -Dclassifier=tests -Dpackaging=test-jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.languagetool -DartifactId=languagetool-core -Dversion=2.7-SNAPSHOT -Dclassifier=tests -Dpackaging=test-jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.languagetool:language-en:jar:2.7-SNAPSHOT
2) org.languagetool:languagetool-core:test-jar:tests:2.7-SNAPSHOT


1 required artifact is missing.

for artifact:
org.languagetool:language-en:jar:2.7-SNAPSHOT

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)


(Daniel Naber) #6

Maven Central contains the latest release, i.e. 2.6. Maven looks there and at your local repository and cannot find 2.7-SNAPSHOT. To work around this, call "mvn install" once in the top folder (speed it up by using "mvn install -DskipTests"), it will install 2.7-SNAPSHOT in the local repository. Not sure why this is needed once (maybe it helps if you don't set "clean" but just call "./build.sh languagetool-standalone package").


(Steph) #7

ok - the good news; it works :smile:

What i do:
1.) "mvn install" - that was the point!
2.) then i call: "./build.sh languagetool-standalone package" -> most perfect i get a build
3.) then i call: "mvn install -DskipTests" to build the whole project :frowning:

It looks like the same problem; but a other dependency:

INFO] ------------------------------------------------------------------------
[INFO] Building LanguageTool Wikipedia tools
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Unable to get dependency information: Unable to read the metadata file for artifact 'org.apache.lucene:lucene-test-framework:jar': Cannot find parent: org.apache.lucene:lucene-parent for project: org.apache.lucene:lucene-test-framework:jar:null for project org.apache.lucene:lucene-test-framework:jar:null
org.apache.lucene:lucene-test-framework:jar:4.9.0

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)

Path to dependency:
1) org.languagetool:languagetool-wikipedia:jar:2.7-SNAPSHOT

The good think - I’d need this for my task; but i like to compile the whole project!


(Daniel Naber) #8

Sounds like a temporary problem, because the file (lucene-test-framework-4.9.0.jar) is available at Maven Central. If it doesn't get better in a few hours, maybe see http://stackoverflow.com/questions/17168977/