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

[pt-PT] Improved rule ID:AVIÃO_DE_COMBATE_PT_PT (regexp+suggestion) #10949

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

marcoagpinto
Copy link
Member

@marcoagpinto marcoagpinto commented Oct 18, 2024

Just improved the regexp + the suggestion message to make it clearer.

Summary by CodeRabbit

  • New Features
    • Enhanced existing language rules for improved clarity and formality.
    • Introduced new rules for more precise terminology and simplification of phrases.
    • Added rules to eliminate redundancy and promote formal language usage.
    • Implemented antipatterns and exceptions for better rule application.

Copy link
Contributor

coderabbitai bot commented Oct 18, 2024

Walkthrough

The pull request introduces significant modifications to the style.xml file within the Portuguese language module of LanguageTool. These changes include enhancements to existing rules, the addition of new rules for clarity and formality, simplification of verbose phrases, and the removal of redundant expressions. The updates also emphasize the use of formal language and introduce antipatterns and exceptions to refine the detection of informal or redundant language.

Changes

File Path Change Summary
languagetool-language-modules/pt/src/main/resources/org/languagetool/rules/pt/pt-PT/style.xml - Added multiple new rules for simplification and formal language adjustments, including:
- AVIÃO_DE_COMBATE_PT_PT: Suggests replacing "avião de combate" with "caça".
- CHEGAR_AO_FIM_FINDAR_TERMINAR: Suggests replacing "chegar ao fim" with "findar" or "terminar".
- FORMAL_DEPRECIATIVO: Addresses depreciative terms.
- DIFICULDADES_PROVAÇÕES: Suggests replacing "dificuldades" with "provações".
- É_IGUAL_AO_LITRO: Suggests replacing "igual ao litro" with "indiferente".
- PÔR_FIM_TERMO: Suggests replacing "pôr fim" with "termo/término".

Possibly related PRs

Suggested reviewers

  • p-goulart
  • susanaboatto

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (4)
languagetool-language-modules/pt/src/main/resources/org/languagetool/rules/pt/pt-PT/style.xml (4)

Line range hint 4111-4132: Great improvements to the 'CHEGAR_AO_FIM_FINDAR_TERMINAR' rule!

The changes enhance the rule's structure and functionality:

  1. The addition of rule ID, name, and type attributes improves the rule's metadata and manageability.
  2. The pattern and message modifications refine the rule's application and suggestion.

One minor suggestion for improvement:

Consider adding an url attribute to the rule, pointing to a reliable source that explains the stylistic preference for "findar/terminar/acabar" over "chegar ao fim". This would provide users with additional context and justification for the suggestion.

Example:

<url>https://example.com/portuguese-style-guide#prefer-concise-verbs</url>

Line range hint 4134-4173: Well-structured improvements to the 'SIMPLIFICAR_DE_VOCÊS_VOSSA_VOSSAS_VOSSO_VOSSOS' rule!

The changes enhance the rule's effectiveness and accuracy:

  1. Splitting the rule into singular and plural subrules allows for more precise handling of different cases.
  2. The refined patterns and suggestions address various grammatical scenarios more effectively.

These modifications should result in more accurate and contextually appropriate suggestions for users.

A potential enhancement to consider:

To further improve the rule's flexibility, you might want to add a third subrule that handles cases where the possessive adjective is followed by a noun. This would allow for more natural-sounding suggestions in complex phrases.

Example:

<rule>
    <pattern>
        <token postag='NC[^C].+' postag_regexp='yes'/>
        <token inflected='yes'>ser</token>
        <marker>
            <token>de</token>
            <token>você</token>
        </marker>
        <token postag='NC.+' postag_regexp='yes'/>
    </pattern>
    <message>&simplify_msg;</message>
    <suggestion><match no='1' postag='NC(..).+' postag_replace='DP3$1S'>seu</match> <match no='5'/></suggestion>
</rule>

This would handle cases like "O carro de você é bonito" → "O seu carro é bonito".


Line range hint 4175-4188: Excellent addition of the 'DEPOIS_É_QUE_VERBO_DEPOIS_VERBO_PT_PT' rule!

This new rule effectively targets a common verbose construction in Portuguese, promoting more concise writing:

  1. The pattern accurately identifies the "Depois é que + Verbo" construction.
  2. The suggestion appropriately simplifies it to "Depois + Verbo".

To further enhance this rule, consider the following suggestion:

Add an example element with an incorrect sentence and its correction to provide clear guidance for users and facilitate testing. For instance:

<example correction="depois">Estava a fazer exercício e só <marker>depois é que</marker> li o texto dela.</example>

This addition would make the rule more user-friendly and easier to verify during testing.


Line range hint 1-4188: Overall, excellent improvements to the Portuguese style rules!

The changes in this file significantly enhance the quality and effectiveness of the style rules for Portuguese in LanguageTool:

  1. Existing rules have been refined and improved, increasing their accuracy and applicability.
  2. New rules have been added to address additional style issues, expanding the tool's capabilities.
  3. The use of advanced tools like ChatGPT 4o for rule enhancement demonstrates a commitment to continuous improvement.

These modifications will result in more precise, helpful, and contextually appropriate suggestions for users, ultimately improving the quality of Portuguese writing.

To further enhance the file:

Consider adding more example elements to rules where they are missing, as this helps with user understanding and facilitates testing.

As the number of rules grows, it may be beneficial to organize them into more specific categories or separate files based on the type of style issue they address. This could improve maintainability and make it easier for contributors to work on specific areas of the ruleset.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5b114a4 and 0e66599.

📒 Files selected for processing (1)
  • languagetool-language-modules/pt/src/main/resources/org/languagetool/rules/pt/pt-PT/style.xml (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
languagetool-language-modules/pt/src/main/resources/org/languagetool/rules/pt/pt-PT/style.xml (1)

Line range hint 4096-4109: Excellent enhancement to the 'AVIÃO_DE_COMBATE_PT_PT' rule!

The modifications significantly improve the rule's effectiveness and precision:

  1. The pattern now covers a wider range of terms related to combat aircraft, increasing the rule's applicability.
  2. The message has been refined to provide more specific guidance on when to use the term "caça".
  3. The use of ChatGPT 4o for enhancements demonstrates a commitment to leveraging advanced tools for rule improvement.

These changes will likely result in more accurate and helpful suggestions for users.

@marcoagpinto marcoagpinto merged commit e69249b into master Oct 18, 2024
5 checks passed
@marcoagpinto marcoagpinto deleted the lt_marcoagpinto_20241018_0717 branch October 18, 2024 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant