A form set you load into the FormModels collection of an IdentificationProcessor can be processed by the GetSimilarFormModels method to detect similar form models. This method requires you to input an index of the FormModel in the FormModels collection. Then, it will produce a collection of indices to templates with a high degree of similarity to the specified model. The simplest way to use this is to call the GetSimilarFormModels method once for each form in the form set, present each list of similar form models to a user, and let them choose which forms are duplicates. The following code demonstrates this concept.
C# Example |
Copy Code |
---|---|
// Create a look up table to store the results of the sequential calls to // GetSimilarFormModels(int). System.Collections.Generic.Dictionary<int, Accusoft.FormFixSdk.IntegerCollection> similarModelLUT = new System.Collections.Generic.Dictionary<int, Accusoft.FormFixSdk.IntegerCollection>(myIDProc.FormModels.Count); // iterate through all indices of FormModels and call GetSimilarFormModels for (int formModelIndex = 0; formModelIndex < myIDProc.FormModels.Count; formModelIndex++) { // declare temp storage var for collection of similar form models Accusoft.FormFixSdk.IntegerCollection tempCollection; // generate list of similar form models to the selected one tempCollection = myIDProc.GetSimilarFormModels(formModelIndex); // put the generated list in the look up table similarModelLUT.Add(formModelIndex, tempCollection); } |
This method should not act as a decision making tool for automated removal of similar form models. The returned collection of similar indices is neither sorted, nor the calculated similarity between two form models made available. Best practice for use of this tool: use as a filtering mechanism before other means of identifying models that are too similar, whether that is an human review or an automated mechanism.