separate scoring function from pattern.md