针对设计模式识别结果的假阴性问题与重叠问题,为提高设计模式实例恢复的精确性,提出一种形式化上下无关文法关系驱动的设计模式检测方法.依据设计模式实例中的参与者属性及其关系,以形式化可视化语言描述模式实例的识别文法.在此基础上,改进该文法检测设计模式实例参与者间的附加关系,并识别共享实例的模式.实验结果表明,新方法不仅减少了模式实例的假阴性结果,还解决了模式实例识别的重叠问题,与其他检测方法的精确度、召回率及F-score指标比较,新方法取得了较好的效果.
Aiming at the false negative problem and the overlap problem in pattern instance detection,in order to improve the accuracy of the design pattern recovery,this article introduces an approach for design pattern detection based on the formal context-free grammar relation driver. Focusing on the attribute and relationship of classes in pattern instances,the formal grammar of pattern instance identification is established using the visual language,and an improved formalism grammar is presented for identifying the additional relationships and the sharing problem of design pattern instances. Experimental results show that,compared with other wellknown algorithms by precision,recall and F-score,the proposed method can reduce the false negative results and the overlap problem in pattern instance detection,indicating the effectiveness of the proposed method.