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

[de] swiss german salutation rule #10805

Closed

Conversation

St-ac-y
Copy link
Collaborator

@St-ac-y St-ac-y commented Aug 2, 2024

A rule that deletes the comma after salutation in Swiss German (as recommended) Is there a way to implement this as style (because the German variant is not super uncommon)?

private final String id;

// Predefined category ids
public static final CategoryId PUNCTUATION = new CategoryId("PUNCTUATION");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This already exists in class CategoryIds

@@ -91,14 +94,17 @@ public List<Rule> getRelevantRemoteRules(ResourceBundle messageBundle, List<Remo

@Override
public List<RuleMatch> filterRuleMatches(List<RuleMatch> ruleMatches, AnnotatedText text, Set<String> enabledRules) {
//First, use the filter in German.java
// First, use the filter in German.java
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't re-format the code in the same commit that makes the actual change

@@ -0,0 +1,75 @@
package org.languagetool.rules.de;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the license header (see other .java files)

+ ")\\b,\\n"
);

private static final Category PUNCTUATION_CATEGORY = new Category(CategoryId.PUNCTUATION, "Punctuation");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above


public SwissGermanSalutationRule(ResourceBundle messages) {
super(messages);
setCategory(PUNCTUATION_CATEGORY); // Set the PUNCTUATION category
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment isn't needed here, as the code shows what's happening


private static final Category PUNCTUATION_CATEGORY = new Category(CategoryId.PUNCTUATION, "Punctuation");

public SwissGermanSalutationRule(ResourceBundle messages) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test case for this class?

@danielnaber
Copy link
Member

Is there a way to implement this as style (because the German variant is not super uncommon)?

You can call setCategory(Categories.STYLE.getCategory(messages)); for that, I think

@St-ac-y St-ac-y closed this Sep 3, 2024
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

Successfully merging this pull request may close these issues.

2 participants