Duke がレコード リストで完全に一致するものを見つけるための構成とプロセッサを作成しようとしています。ExactMatchComparator ベースのプロセッサを作成しましたが、関数が正確な一致を返しません。プロセッサ、構成、およびリスナーのセットアップは次のとおりです。
public void setup() {
//setup
List<Property> exactMatchProperties = new ArrayList<Property>();
exactListener = new TestUtils.TestListener();
ExactComparator exactComparator = new ExactComparator();
//create properties (columns), with name, comparator, and high-low thresholds. ID property has no comparator or propabilities.
exactMatchProperties.add(new PropertyImpl("ID"));
exactMatchProperties.add(new PropertyImpl("NAME", exactComparator, 0.0, 1.0));
exactMatchProperties.add(new PropertyImpl("EMAIL", exactComparator, 0.0, 1.0));
//create new configuration implementation
exactMatchConfig = new ConfigurationImpl();
//add properties to config
exactMatchConfig.setProperties(exactMatchProperties);
exactMatchConfig.setThreshold(1.0);
exactMatchConfig.setMaybeThreshold(0.0);
//initialize the processor and add match listener
exactMatchProcessor = new Processor(exactMatchConfig, true);
exactMatchProcessor.addMatchListener(exactListener);
}
テストする関数は次のとおりです。
public void testExactMatch() {
Collection<Record> records = new ArrayList<Record>();
Record rec1 = TestUtils.makeRecord(new String[] { "ID", "1", "NAME", "Jon", "EMAIL", "jon@doe.com" });
Record rec2 = TestUtils.makeRecord(new String[] { "ID", "1", "NAME", "Jon", "EMAIL", "jon@doe.com" });
records.add(rec1);
records.add(rec2);
exactMatchProcessor.deduplicate(records);
System.out.println(exactListener.getMatches().size());
}
私はAPIを使用しており、ここで言及されているSOに関する質問を読みましたが、Javaでテストを行っている間、その質問はXMLを参照しています。
getMatches を空にしないでください。見つかった重複のリスト、またはその逆 (重複のない一意のレコードのリスト) を取得するにはどうすればよいですか? ありがとう