Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend JSON API to accept markup instead of plain text only #757

Closed
JBR69 opened this issue Aug 1, 2017 · 7 comments
Closed

Extend JSON API to accept markup instead of plain text only #757

JBR69 opened this issue Aug 1, 2017 · 7 comments

Comments

@JBR69
Copy link

JBR69 commented Aug 1, 2017

Hi,

I use languageTool to check documents in asciidoc.
I would like to exclude from verification regular expressions; is it possible ? How?

For example, in my text I can have
Lorem ipsum dolor sit amet, a and sit, [red]#elementum# semper erat nibh magna donec adipiscing, masso como leo dui massa
And I don't want to control the content between [ and ] (red)

Jérôme

@danielnaber
Copy link
Member

Do you use the LT Java API? Then you can use https://languagetool.org/development/api/org/languagetool/markup/AnnotatedTextBuilder.html to define markup and text.

@JBR69
Copy link
Author

JBR69 commented Aug 1, 2017

No I use LT with HTTP Server

@danielnaber
Copy link
Member

This is not supported yet, sorry. Pull requests welcome, the place where this would need to be added is https://github.com/languagetool-org/languagetool/blob/master/languagetool-server/src/main/java/org/languagetool/server/ApiV2.java#L60

@danielnaber danielnaber changed the title Don't control certain expressions Don't check certain expressions Aug 4, 2017
@danielnaber danielnaber changed the title Don't check certain expressions Extend JSON API to accept markup instead of plain text only Aug 18, 2017
@johanneswilm
Copy link

How would you want for the api to receive the data? Instead of

text: "text to be checked"

would you allow to alternatively receive a JSON structure like this?

annotatedText: [
    {type: 'text', text: 'text to be '},
    {type: 'markup', text: '<b>'},
    {type: 'text', text: 'checked'},
    {type: 'markup', text: '</b>'}   
]

Or what other format would be in line with languagetool's philosophy?

@danielnaber
Copy link
Member

I guess the alternative would be this?

annotatedText: [
   {text: 'text'},
   {markup: '<b>'}
]

It's a bit more compact, but I'm not sure. What do you think? Are there other approaches?

@johanneswilm
Copy link

I don't know about other approaches. I like your markup better than mine though.

@danielnaber
Copy link
Member

This has now been implemented. Will probably be online at languagetool.org later today. Documented at https://languagetool.org/http-api/swagger-ui/#!/default/post_check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants