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

Why not using AnnotatedText #80

Closed
PierreMarchand20 opened this issue Apr 11, 2019 · 2 comments
Closed

Why not using AnnotatedText #80

PierreMarchand20 opened this issue Apr 11, 2019 · 2 comments

Comments

@PierreMarchand20
Copy link
Contributor

I am looking around the repository, and I am wondering: why did not you use AnnotatedText as explained here (http://wiki.languagetool.org/java-api) ? it is not practical ?

@sylvainhalle
Copy link
Owner

sylvainhalle commented Apr 11, 2019

First off, I shall say that in the current state of the program, I don't plan to turn everything around in the code to use the annotated strings provided by LanguageTool. ;-)

When I started coding, my main design arguments for not using them was:

  • To create such an object, you need to parse the original LaTeX file in order to insert the markup chunks and the text chunks one by one. As I said in Too much LaTeX interpretation #56, I don't want to end up writing a LaTeX parser or interpreter. In contrast, what TeXtidote does is much simpler: a handful of regex find/replace operations on the original text.
  • Even though the process is simpler, TeXtidote's AnnotatedString actually does more than LT's AnnotatedText. In AnnotatedText you can only identify parts of the text that are to be ignored, but you cannot transform the object once it is created. In contrast, AnnotatedString implements almost all the methods of a regular String object: you can find/replace, extract substrings, etc. and still keep the relative positioning with respect to the original text. This is much more flexible.
  • I plan to reuse the AnnotatedString class on some other project (not done yet) where AnnotatedText could not be used in replacement, so there was sense in investing time to create this class.

@PierreMarchand20
Copy link
Contributor Author

PierreMarchand20 commented Apr 11, 2019

Ok, thank you for your answer ! I was just curious ^^

It is a really useful repository and I hope it will integrated to some editors like vscode, would it be something interesting for you ?

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

2 participants