RelEx outputs simplified representations of the grammatical structure of input sentences. This wiki page provides comprehensive overview how RelEx Sentence Algorithm works. In this blog post I'm assuming that readers have a good understanding of how RelEx sentence algorithm works.
In this blog post, I'm trying to address how can we form binary relationships when words are apart by multiple words in between them. (RelEx binary relationship related rules are defined in the relex-semantic.alg file.)
For e.g. take following sentence
The snail is running exactly as fast as the cheetah. This sentence forms a "_advmod(fast, exactly)". (you can find full set of binary relationships for this sentence from here)But as you can see from the below Link-Parser output, terms "exactly" and "fast" are apart from term "as". So in these situations we have two options to make the correct binary relationship formation.
Option 1
Navigate through feature graph using alternative path of the different links between the two relevant nodes
Look at last line of the below rule. On the RHS of the rule it points to the terms "exactly" through path navigation through the featuregraph. Here "F_R" refers to the node "as" ,"linkL0" refers to the "EZ" node and "F_L ref" to the term "exactly"
Option 2
Use a temporary featurenode like 'adv-temp' as a variable pointing to "exactly" to pass the needed information.
In the first part of the below code it creates a temporary featurenode like 'adv-temp'
In the second part it uses the previously created temp feature node to form the binary relationship
In this blog post, I'm trying to address how can we form binary relationships when words are apart by multiple words in between them. (RelEx binary relationship related rules are defined in the relex-semantic.alg file.)
For e.g. take following sentence
The snail is running exactly as fast as the cheetah. This sentence forms a "_advmod(fast, exactly)". (you can find full set of binary relationships for this sentence from here)But as you can see from the below Link-Parser output, terms "exactly" and "fast" are apart from term "as". So in these situations we have two options to make the correct binary relationship formation.
Figure 1- Link_parser parse tree |
Option 1
Navigate through feature graph using alternative path of the different links between the two relevant nodes
Look at last line of the below rule. On the RHS of the rule it points to the terms "exactly" through path navigation through the featuregraph.
#TemplateActionAlg ADV1 <LAB> = \EEy <F_R linkL0 LAB> = \MVa = <F_R BACKGROUND-FLAG> = T <F_R ref links _advmod> += <F_R linkL0 F_L ref>
Option 2
Use a temporary featurenode like 'adv-temp' as a variable pointing to "exactly" to pass the needed information.
In the first part of the below code it creates a temporary featurenode like 'adv-temp'
#TemplateActionAlg ADV1_1 <LAB> = \MVa = <F_R adv-temp> += <F_L ref>
In the second part it uses the previously created temp feature node to form the binary relationship
#TemplateActionAlg ADV1_2 <LAB> = \EEy <F_R linkL0 LAB> = \MVa <F_L adv-temp> != % = <F_R ref links _advmod> += <F_L adv-temp>