Open zeth opened 3 years ago
I agree, that would be useful to have. Especially considering that not all languages have the same rules all available, I think. I also wanted to add customizable coloring of the marks in the text instead of relying on a fixed palette. But there wasn't much room in the GUI back then and I didn't want to create another page for it. But I guess, that's something to add in the GUI rework I am working on (something like settings for optional plugins like LanguageTool and Pandoc which show up if the software installed).
I am trying to play with the dependency. It has a enabled_categories and enabled_rules but have I haven't figured out how to make it do anything yet. I did this.
import language_tool_python
tool = language_tool_python.LanguageTool('en-GB')
text = 'A sentence with a error in the Hitchhiker’s Guide tot he Galaxy'
matches = tool.check(text)
categories = "PUNCTUATION,TYPOGRAPHY,CASING,COLLOCATIONS,CONFUSED_WORDS,CREATIVE_WRITING,GRAMMAR,MISC,MISUSED_TERMS_EU_PUBLICATIONS,NONSTANDARD_PHRASES,PLAIN_ENGLISH,TYPOS,REDUNDANCY,SEMANTICS,TEXT_ANALYSIS,STYLE,GENDER_NEUTRALITY"
for category in categories.split(','):
tool.enabled_categories.add(category)
single_rules = "AND_ALSO,ARE_ABLE_TO,ARTICLE_MISSING,AS_FAR_AS_X_IS_CONCERNED,BEST_EVER,BLEND_TOGETHER,BRIEF_MOMENT,CAN_NOT,CANT_HELP_BUT,COMMA_WHICH,EG_NO_COMMA,ELLIPSIS,EXACT_SAME,HONEST_TRUTH,HOPEFULLY,IE_NO_COMMA,IN_ORDER_TO,I_VE_A,NEGATE_MEANING,PASSIVE_VOICE,PLAN_ENGLISH,REASON_WHY,SENT_START_NUM,SERIAL_COMMA_OFF,SERIAL_COMMA_ON,SMARTPHONE,THREE_NN,TIRED_INTENSIFIERS,ULESLESS_THAT,WIKIPEDIA,WORLD_AROUND_IT"
for rule in single_rules.split(','):
tool.enabled_rules.add(rule)
matches = tool.check(text)
If it's just not me being stupid, I may have to make a patch for the language_tool_python to add the configurability we want.
Sure, you could add the rules to the main configuration file probably.
I love the LanguageTool integration.
The LibreOffice plugin has a nice little UI that allows you to select and deselect rules. It would be nice to have one for Manuskript, or a config file or something. Excuse me if I'm stupid and missing an existing one.