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] Added rule ID:DEMASIADO_INVARIAVEL #10905

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

marcoagpinto
Copy link
Member

@marcoagpinto marcoagpinto commented Sep 29, 2024

Hello, @susanaboatto and @p-goulart ,

Here is the second rule I talked about in the previous pull request.

Thanks!

Summary by CodeRabbit

  • New Features
    • Introduced a new grammar rule for Portuguese: DEMASIADO_INVARIAVEL, which corrects the usage of "demasiado" when intensifying adjectives.
    • Users will receive suggestions to replace incorrect forms with the appropriate usage, enhancing grammar accuracy.

Copy link

coderabbitai bot commented Sep 29, 2024

Warning

Rate limit exceeded

@marcoagpinto has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 11 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Files that changed from the base of the PR and between 808479b and 82a62b3.

Walkthrough

A new grammar rule has been introduced for Portuguese in the grammar.xml file. The rule, named DEMASIADO_INVARIAVEL, focuses on the correct usage of the adjective "demasiado" when it modifies other adjectives. It includes a pattern that identifies specific verbs followed by "demasiadas?" or "demasiados" and provides a correction suggestion to use "demasiado" instead.

Changes

File Change Summary
languagetool-language-modules/pt/src/main/resources/org/languagetool/rules/pt/grammar.xml Added a new rule DEMASIADO_INVARIAVEL to address the invariant usage of "demasiado" with adjectives.

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

@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: 1

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

1063-1076: LGTM! Consider removing the ChatGPT comment.

The rule structure is well-formed and follows the expected format for LanguageTool rules. The default state of 'temp_off' is appropriate for a new rule that may need further testing.

Consider removing the comment about using ChatGPT (line 1064) as it's not necessary for the rule's functionality and may not be relevant in the long term.


1065-1071: LGTM! Consider improving readability of long regex patterns.

The pattern matching logic is comprehensive and well-structured. It effectively captures the intended usage of "demasiado" with various verbs and adjectives.

For improved readability, consider breaking the long regex patterns for verbs (line 1066) and adjectives (line 1070) into multiple lines or storing them in separate variables. This can make future maintenance easier.


1074-1075: Consider adding an example with "demasiados".

The current examples effectively demonstrate the rule's application for "demasiada". However, the pattern also matches "demasiados".

For completeness, consider adding a third example that shows the correction of "demasiados" to "demasiado". For instance:

<example correction="demasiado">Estes problemas são <marker>demasiados</marker> complexos.</example>

This would cover all cases matched by the pattern.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d5b9008 and 808479b.

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

1072-1073: LGTM! Clear and concise message and suggestion.

The error message clearly explains the grammar rule, and the suggestion provides the correct form. This is well-implemented and should be helpful for users.

Comment on lines 1063 to 1076
<rule id='DEMASIADO_INVARIAVEL' name="Demasiada → demasiado" default='temp_off'>
<!-- Used ChatGPT 4o for enhancements and extra accuracy -->
<pattern>
<token regexp='yes' inflected='yes'>andar|continuar|estar|ficar|manter|parecer|revelar|ser|soar|tornar</token>
<marker>
<token regexp='yes'>demasiadas?|demasiados</token>
</marker>
<token regexp='yes' inflected='yes'>real|forte|pesado|triste|rápido|perigoso|complicado|difícil|fácil|lento|quente|frio|importante|grave|curioso|interessante|estranho|amargo|doce|justo|injusto|profundo|superficial|óbvio|sério|simples|longo|curto|chato|intenso|delicado|bonito|feio|útil|inútil|ridículo|vazio|cheio|certo|errado</token>
</pattern>
<message>O adjetivo &quot;demasiado&quot; é invariável quando usado para intensificar adjetivos, como &quot;real&quot;.</message>
<suggestion>demasiado</suggestion>
<example correction="demasiado">Esta dor é <marker>demasiada</marker> real.</example>
<example correction="demasiado">Estas dores são <marker>demasiada</marker> reais.</example>
</rule>
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Testing Strategy Updated with Identified Cases

The search identified several sentences containing 'demasiada' or 'demasiados' followed by an adjective. To ensure the grammar rule effectively handles these cases:

  1. Include Identified Sentences as Test Cases:

    • Add the following sentences to your test suite to validate the rule:
      • Foi-lhe dada demasiada importância até que surgira uma nova teoria.
      • Foi-lhes dada demasiada importância até que surgiram novas teorias.
      • Son demasiados niñas.
      • Se lamenta de que hay demasiadas preguntas y demasiado pocas respuestas.
      • Tienes demasiadas esperanzas puestas en ella.
  2. Implement Monitoring for Identified Cases:

    • Track the rule's performance on these sentences to identify any false positives or negatives.
    • Collect user feedback specifically related to these instances to refine the rule further.

This approach will help in fine-tuning the grammar rule and ensuring its accuracy in real-world scenarios.

🔗 Analysis chain

Suggest testing strategy and monitoring plan.

The rule is well-implemented and ready for testing. To ensure its effectiveness and catch any potential issues:

  1. Run the following script to find potential test cases in the existing corpus:

  2. Once the rule is activated, consider implementing a monitoring plan to track:

    • False positives: Cases where the rule incorrectly flags proper usage.
    • False negatives: Cases where incorrect usage is not caught by the rule.
    • User feedback: Any comments or reports from users about the rule's behavior.

This will help in fine-tuning the rule and ensuring its accuracy in real-world usage.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for sentences containing 'demasiada' or 'demasiados' followed by an adjective
rg -i "demasiada\w?\s+\w+[oa](\s|\.)" --type txt

Length of output: 50


Script:

#!/bin/bash
# Search for sentences containing 'demasiada' or 'demasiados' followed by an adjective in multiple file types
rg -i "demasiada\w?\s+\w+[oa]" --type-add 'all:*.txt,*.xml,*.md,*.java,*.js,*.py' -g '*' --ignore-case

Length of output: 164


Script:

#!/bin/bash
# Search for sentences containing 'demasiada' or 'demasiados' followed by an adjective in multiple file types
rg -i "demasiada\w?\s+\w+[oa]" -g "*.txt" -g "*.xml" -g "*.md" -g "*.java" -g "*.js" -g "*.py" --ignore-case

Length of output: 1589

@marcoagpinto marcoagpinto merged commit ed422d6 into master Oct 1, 2024
5 checks passed
@marcoagpinto marcoagpinto deleted the lt_marcoagpinto_20240929_1634 branch October 1, 2024 16:31
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.

2 participants