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

[Bug]: Strange error when setting feature #436

Open
1 task done
nschneid opened this issue Feb 13, 2025 · 2 comments
Open
1 task done

[Bug]: Strange error when setting feature #436

nschneid opened this issue Feb 13, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@nschneid
Copy link

Is there already an issue for this?

  • I have searched the existing issues

Current Behavior

rule r5 { % keep them lovely kebabs coming: leave det(kebabs, them) but mark "them" as Style=Vrnc
    pattern {
      X[lemma=they]; 
      Y-[det]->X;
    }
    commands { 
      X.Style="Vrnc";
    }
}

The above rule should apply to 1 token in my data. The pattern works but the command causes an error

GREW-ERROR : [line: 1] More than 10000 rewriting steps: check for loops or increase max_rules value. Last rules are: […r5, r5, r5, r5, r5, r5, r5, r5, r5, r5]

Setting the lemma is not a problem. The "Style" feature is listed in the project settings with "Vrnc" as a possible value, so I'm not sure what's wrong here.

Steps To Reproduce

  1. Run the above rule on English-EWT test set
  2. Error occurs

Project name

No response

Anything else?

No response

What browsers are you seeing the problem on?

Firefox

@nschneid nschneid added the bug Something isn't working label Feb 13, 2025
@bguil
Copy link
Collaborator

bguil commented Feb 13, 2025

This is a well-know issue with rewriting. As a rule may apply several times in different parts of the same sentence, the system applies the rules iteratively until no more application is possible.

With your rule, after the first application, the pattern is still "there" and so the rule can apply again and again (with no effect).
In your case, you have to ensure that this cannot happen. The easiest way is to use a withoutcondition:

rule r5 { % keep them lovely kebabs coming: leave det(kebabs, them) but mark "them" as Style=Vrnc
    pattern {
      X[lemma=they]; 
      Y-[det]->X;
    }
    without { X.Style = "Vrnc" }
    commands { 
      X.Style="Vrnc";
    }
}

@nschneid
Copy link
Author

Interesting! Could the error message be made more informative, e.g. "Note that a rule will apply continually as long as its precondition remains true"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants