In the recent years, detection and automatic refactoring of code smell is one of the focus topic in software engineering, and duplicated code is a kind of common code smell. Based on the duplicated code recogni-tion method of text, the false positives can be reduced through the lexical analysis to compare the source code after handling the specific token and through the comparison with the abstract syntax tree to filter the results. The test re-sults show that the method has better detection effect of duplicated code. This has great significance in the study of automatic detection algorithm of...