Is it possible to include a category (test rules) in such a way that if it exists (on development machine) it is processed, but if not there (production) it is not used and does not raise an error?
Can you describe what exactly you want to test? If a category isn’t there, it will not be processed
When creating rules on my local machine, I only want to commit the correct rules. But since ‘trial’ rules and ‘okay’ rules are in one file, I have to keep on removing the test rules from the grammar file before doing a commit after updating postags or speller.
I am looking for something like
‘if exist testgrammar.xml include testgrammar.xml’
I could also programmatically change default=on to default =off in the category, but then the rules still get into production, and I do not want that.
And I could program my own ‘include’ program; but I thought maybe more people would benefit from this.
You can create a file called
grammar-test-1.xml now and it should be used if it exists and ignored if it doesn’t exist. I have also set it to “ignore” for git so git should not commit it to the repo. Please let me know how it works.
How exactly? Should it be a complete grammar file i.e. including [rules] etc? Do I have to change anything in grammar.xml
Just create that file like grammar.xml but without the rules, i.e. all the structure must be there. Nothing needs to be changed in grammar.xml. You need the latest code as I needed to make changes to make that work.
I understood. It works now, apart from the Jlanguagetooltest (again). If one of the experimental rules creates a hit, the number of hits is bigger than specified in the test routine.
So I commented that out too.
Changed my ‘grammar file rule change checker’ to incorporate the second grammar file, and now it seems to work nicely.
There is one minor thing; locally, the test grammar file is also compiled and tested. So before doing a commit, I will have to rename it, compile and test, and rename back. But that is easy.