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] More verbs/nouns fixes in disambiguation.xml #11104

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

marcoagpinto
Copy link
Member

@marcoagpinto marcoagpinto commented Dec 13, 2024

Another milestone!

Summary by CodeRabbit

  • New Features
    • Introduced a new rule for improved disambiguation of rare verbs in Portuguese.
    • Added a specific rule targeting verb structures with prepositions or conjunctions.
  • Bug Fixes
    • Modified existing rule to correctly handle hyphenated words with past participles.

Copy link
Contributor

coderabbitai bot commented Dec 13, 2024

Walkthrough

The pull request introduces a new rule in the disambiguation.xml file for the Portuguese language module of LanguageTool. The rule, VERB_INFINITIVE_PASTPARTICIPLE_VERBS_RARE, aims to prevent rare verbs from being interpreted as verbs in specific contexts involving determiners. Additionally, it modifies the existing rule NOUN_HYPHEN_PASTPARTICIPLE_VERBS_RARE to ensure compatibility with the new rule. The changes include comments with examples to illustrate the functionality of the new rule, enhancing the disambiguation capabilities for rare verbs.

Changes

File Change Summary
languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml - Added new rule VERB_INFINITIVE_PASTPARTICIPLE_VERBS_RARE to manage rare verbs in specific contexts.
- Modified existing rule NOUN_HYPHEN_PASTPARTICIPLE_VERBS_RARE for compatibility with the new rule.
- Included comments with examples of rule functionality.

Possibly related PRs

Suggested reviewers

  • jaumeortola
  • 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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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 (3)
languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml (3)

3816-3835: LGTM! Consider adding more test cases.

The rule correctly handles disambiguation of past participles when preceded by an infinitive verb and determiner. The provided examples demonstrate valid cases.

Consider adding negative test cases (examples where the rule should not apply) to ensure the pattern doesn't over-match.


Line range hint 3836-3862: LGTM! Consider enhancing documentation.

The rule correctly handles disambiguation of past participles in hyphenated words. The examples effectively demonstrate the rule's application.

Consider adding inline documentation explaining why certain exceptions are needed in the pattern, particularly:

<exception postag_regexp='yes' postag='V.+|CS|RG|CC|SPS.+|[DP].+'/>

Line range hint 3863-3899: LGTM! Consider pattern optimization.

The rule correctly handles disambiguation of verbs followed by specific words. The extensive examples effectively demonstrate various use cases.

Consider:

  1. Breaking down the complex pattern into multiple simpler rules for better maintainability
  2. Adding comments explaining why each optional element is needed
  3. Grouping the target words (pela|como|sobre|nada|acerca|el[ae]s?) into an entity for reuse
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b333640 and 92dff12.

📒 Files selected for processing (1)
  • languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml (1 hunks)

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 (1)
languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml (1)

3816-3836: Consider adding more test cases to verify edge cases.

While the provided examples cover common cases, consider adding test cases for:

  1. Negated forms (e.g., "não vou terminar o doutorado")
  2. Complex determiners (e.g., "vou terminar aquele doutorado")
  3. Multiple participles (e.g., "peixe-dourado-prateado")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b333640 and 92dff12.

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

3816-3835: LGTM! Well-structured rule for handling rare verbs in infinitive-participle contexts.

The rule effectively prevents rare verbs from being incorrectly tagged as verbs when they appear after an infinitive verb and determiner. The examples provided demonstrate valid use cases.


3836-3836: LGTM! Well-structured rule for handling past participles in hyphenated words.

The rule correctly handles cases where past participles appear in hyphenated words, removing the verb tag when appropriate. The examples demonstrate common use cases like "não-autorizado" and "peixe-dourado".


3816-3836: Verify the impact on existing rules.

The placement of these rules at the end of the file is correct, but let's verify there are no conflicts with existing rules.

✅ Verification successful

No conflicts found with the rule placement and pattern

The rule VERB_INFINITIVE_PASTPARTICIPLE_VERBS_RARE is correctly placed at the end of the disambiguation rules section, and its pattern does not conflict with other rules. The search results show that:

  1. The rule is part of a series of carefully ordered rules that handle rare verb forms
  2. Similar patterns in other rules (like NOUN_HYPHEN_PASTPARTICIPLE_VERBS_RARE and PELA_COMO_SOBRE_NADA_ACERCA_ELAR_VERBS_RARE) are also placed in the same section
  3. The rule's specific pattern (VMN0000 followed by D[AI] and VMP00) is unique and doesn't overlap with other rules' patterns
  4. The examples provided in the comments demonstrate the intended behavior
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential rule conflicts by looking for similar patterns in existing rules
# Search for rules that also handle VMN0000, D[AI].+, and VMP00.+ patterns
rg -A 5 'VMN0000.*D\[AI\]|VMP00' | grep -v 'VERB_INFINITIVE_PASTPARTICIPLE_VERBS_RARE|NOUN_HYPHEN_PASTPARTICIPLE_VERBS_RARE'

# Search for rules that handle hyphenated words with past participles
rg -A 5 'hifen.*VMP00|VMP00.*hifen'

Length of output: 73717


Script:

#!/bin/bash
# Search for rules that handle similar patterns with VMN0000 and VMP00 in the same rule
rg -A 5 'VMN0000.*VMP00|VMP00.*VMN0000' languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml

# Search for rules that appear before the VERB_INFINITIVE_PASTPARTICIPLE_VERBS_RARE rule
rg -B 10 'VERB_INFINITIVE_PASTPARTICIPLE_VERBS_RARE' languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml

Length of output: 1112


Script:

#!/bin/bash
# Search for rules that handle verb patterns with D[AI] and VMP00 to check for potential conflicts
rg -B 5 -A 5 'postag=.D\[AI\].+.*VMP00|VMP00.*postag=.D\[AI\]' languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml

# Check for any rules that might be affected by this rule's position
rg -B 5 -A 15 '<rule.*>.*<pattern>.*<token postag=.VMN0000.*<token postag=.D\[AI\]' languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml

Length of output: 350


Script:

#!/bin/bash
# Try a more lenient search pattern to find rules with similar verb patterns
rg -B 5 -A 10 'postag=.VMN0000.*postag_regexp="yes".*<token.*postag=.D' languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml

# Also search for any rules that handle past participles after determiners/articles
rg -B 5 -A 10 'postag=.D.*>.*<token.*postag=.VMP00' languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml

# Look for any rules that might be affected by the position of this rule
rg -B 5 -A 10 '<rule.*name="Remove.*verb' languagetool-language-modules/pt/src/main/resources/org/languagetool/resource/pt/disambiguation.xml

Length of output: 7557

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