Adding structural constraints to lexically based context matching techniques