Rule: there <noun>

Hello

Can sm tell me why this rule doesn’t work.

The idea was to detect errors like

‘It was there (their) idea’

Thanks for any pointers

<rule id="THERE_MISTAKE" name="There (their) mistake">    
		<pattern>
			<token skip="-1">there<exception scope="next"regexp="yes">is|are</exception></token>			
			<token postag="NN|NNS|NN:U|NN;UN|VBG" postag_regexp="yes"></token>
			</pattern>
			
<message>Did you mean <suggestion>their</suggestion>?</message>
			<example type="incorrect"><marker>There</marker>mistake caused    errors.</example>
			<example type="correct">Their mistake was spotted.</example>
			</rule>

Does it not work in the sense that it doesn’t find the error or is there a different problem? I suggest you start with a simple pattern like this and then add stuff:

there idea

This way you can see when a problem occurs.

BTW, there are some typos in your rule, e.g. a missing space before “regexp=”

I don’t know why the above rule doesn’t work either, except that the semicolon in the regular expression looks a bit suspicious–was that meant to be a colon perhaps? But then, I am by no means an expert in the English pos tags.

On an unrelated note, I would like to suggest that you don’t use for the purpose at hand. skip="-1" means that any number of tokens in the sentence may be skipped before the noun, which seems way too general to me. For example, the sentence
We have a nice little house there in Albuquerque, with a swimming pool.
would match your pattern (if it worked), because ‘there’ is not immediately followed by ‘is’ or ‘are’ and then (after skipping seven tokens) by the noun ‘pool’.

Starting from simple patterns and then generalizing as Daniel suggested is a good idea in my opinion. I wrote a lot of simple rules before I started using the more advanced (and more risky) stuff, such as skip and postags.

Hello dnaber and Jan Schreiber

I corrected the two little errors you pointed out and the rule seems to work

I almost fell of my chair.

This is one small step for mankind, but one giant leap for me!

Thanks guys

Hope you will continue to help me cos I don’t have many good days like this when it comes to writing rules and the questions will continue to flow like wine at at Roman orgy

Hello Jan

I do understand your remark but I can live with a few false alerts

The idea was to ignore things like adverbs, adjectives, conjunctions, and sub clauses

eg

‘there INCREDIBLY (adverb) STUPID (adjective) YET (conjunction) AS FAR AS I CAN SEE (sub clause) idea’

and the rule seems to work on the above sentence

As for your example, I did realise that I would get false hits when ‘there’ is used as an adverb of place but I had no idea how to write a rule to take this into account

The rule gives a false hit for ‘There in the house’ as you rightly predict

If you can propose an improvement on my rule, I’d be very interested to see how you go about it and write the improved rule

Thanks again

SafeTex