goete111 / factorie

Automatically exported from code.google.com/p/factorie
0 stars 0 forks source link

Implement multiple bound variables for Foreach and Forany. #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Users can currently create multiple-argument templates by navigating through 
relations from 
a single root. However some desirable patterns would require multiple usages of 
a bound 
second variable.

In sensible templates there must be some relationship between the original root 
variable and 
the second variable. Rather than embedding this relationship arbitrarily in the 
clause itself 
we will make it more explicit by using it in the introduction of this second 
variable.  

Possible syntax:

Forany2[Person,Person] { p => p.respects } { (p1, p2) => !p1.smokes ^ p2.smokes 
} * 0.5

This expresses the preference:

For any person1, for any person2 respected by person1, consider the case in 
which person1 
does not smoke and person2 does smoke; each occurence of this case makes the 
possible 
world less likely by a factor of two.    

Original issue reported on code.google.com by andrew.k.mccallum on 27 Nov 2009 at 8:42