some code about pattern Recognition