简体   繁体   English

杜克重复数据删除引擎:完全相同的记录不匹配

[英]Duke deduplication engine : exact same record not matched

I am attempting to use Duke to match records from one csv to another.First csv and second both has ID,Model,Price,CompanyName,Review,Url columns. 我正在尝试使用Duke将记录从一个csv匹配到另一个。第一个csv和第二个都具有ID,Model,Price,CompanyName,Review,Url列。 I am trying to match to another csv to find duplicates records. 我正在尝试匹配另一个csv以查找重复记录。

package no.priv.garshol.duke;

import no.priv.garshol.duke.matchers.PrintMatchListener;

public class RunDuke {

  public static void main(String[] argv) throws Exception {
    Configuration config =
        ConfigLoader
            .load("/home/kishore/Duke-master/doc/example-data/presonalCare.xml");
    Processor proc = new Processor(config);
    proc.addMatchListener(new PrintMatchListener(true, true, true, false, config.getProperties(),
        true));
    proc.link();
    proc.close();
  }

}

Here is an example of personalCare.xml : 这是personalCare.xml的示例:

<!-- language: xml -->
<!-- For more information, see https://github.com/larsga/Duke/wiki/ Improvements 
    needed: - some area numbers have spaces in them - not stripping accents from 
    names -->
<duke>
    <schema>
        <threshold>0.7</threshold>
        <property type="id">
            <name>ID</name>
        </property>
        <property>
            <name>Model</name>
            <comparator>no.priv.garshol.duke.comparators.Levenshtein</comparator>
            <low>0.4</low>
            <high>0.8</high>
        </property>
        <property>
            <name>Price</name>
            <comparator>no.priv.garshol.duke.comparators.ExactComparator</comparator>
            <low>0.04</low>
            <high>0.73</high>
        </property>
        <property>
            <name>CompanyName</name>
            <comparator>no.priv.garshol.duke.comparators.Levenshtein</comparator>
            <low>0.4</low>
            <high>0.8</high>
        </property>
        <property>
            <name>Review</name>
            <comparator>no.priv.garshol.duke.comparators.Levenshtein</comparator>
            <low>0.12</low>
            <high>0.93</high>
        </property>
        <property>
            <name>Url</name>
            <comparator>no.priv.garshol.duke.comparators.Levenshtein</comparator>
            <low>0.12</low>
            <high>0.93</high>
        </property>
    </schema>

    <database class="no.priv.garshol.duke.databases.InMemoryDatabase">
    </database>

    <group>
        <csv>
            <param name="input-file" value="personal_care_11.csv" />
            <param name="header-line" value="false" />
            <column name="1" property="ID" />
            <column name="2" property="Model" cleaner="no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"/>
            <column name="3" property="Price" />
            <column name="4" property="CompanyName" cleaner="no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"/>
            <column name="5" property="Review" cleaner="no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"/>
            <column name="6" property="Url" cleaner="no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"/>
        </csv>
    </group>

    <group>
        <csv>
            <param name="input-file" value="personal_care_11.csv" />
            <param name="header-line" value="false" />
            <column name="1" property="ID" />
            <column name="2" property="Model" cleaner="no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"/>
            <column name="3" property="Price" />
            <column name="4" property="CompanyName" cleaner="no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"/>
            <column name="5" property="Review" cleaner="no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"/>
            <column name="6" property="Url" cleaner="no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"/>
        </csv>
    </group>


</duke>

The above code is working fine but it does not match the exact record example 上面的代码工作正常,但与确切的记录示例不匹配

STHDRNFKAQ4AFYE8,Littmann 3M Classic II S.E Acoustic
Stethoscope,6297,Littmann,,http://dl.flipkart.com/dl/littmann-3m-classic-ii-s-e-acoustic-stethoscope/p/itme3uhzbqxhzfda?pid=STHDRNFKAQFAFYE8&affid=3ba0de4902524e2b90e43b84b89ea0ef

which is in both csv files. 在两个csv文件中。 I also want to know the work of low and high property value which is given in .xml file, how to decide the low and high value for column value. 我还想知道.xml文件中给出的低和高属性值的工作,如何确定列值的低和高值。

You are doing record linkage (two data sets) and not deduplication (single data set), so take out the .deduplicate() call. 您正在执行记录链接(两个数据集)而不是重复数据删除(单个数据集),因此请执行.deduplicate()调用。

Also, please don't use the 'no.priv.garshol.duke' package name. 另外,请不要使用“ no.priv.garshol.duke”软件包名称。 You should never use domain names you don't own yourself. 您绝对不要使用自己不拥有的域名。

Anyway, the reason you can't find any matches is that the two records have the same ID. 无论如何,您找不到任何匹配项的原因是两条记录具有相同的ID。 Duke verifies that it's not reporting records as matching themselves, and so the match gets filtered out. 杜克(Duke)验证它没有将记录报告为与自己匹配,因此匹配被过滤掉了。 If you make a copy of the csv file and use that for group 2, then make a change to the ID then Duke finds the duplicate. 如果您制作了一个csv文件的副本并将其用于第2组,则对ID进行更改,然后Duke会找到副本。

Here's what happens when I try that: 当我尝试以下操作时会发生以下情况:

[lars.garshol@laptop tmp]$ java -cp ~/cvs-co/duke/duke-core/target/duke-core-1.3-SNAPSHOT.jar:. no.priv.garshol.duke.Duke --showmatches presonalCare.xml 

MATCH 0.9982630751840313
ID: 'SHDRNFKAQ4AFYE8', Model: 'littmann 3m classic ii s.e acoustic stethoscope', Price: '6297', CompanyName: 'littmann', Url: 'http://dl.flipkart.com/dl/littmann-3m-classic-ii-s-e-acoustic-stethoscope/p/itme3uhzbqxhzfda?pid=sthdrnfkaqfafye8&affid=3ba0de4902524e2b90e43b84b89ea0ef', 
ID: 'STHDRNFKAQ4AFYE8', Model: 'littmann 3m classic ii s.e acoustic stethoscope', Price: '6297', CompanyName: 'littmann', Url: 'http://dl.flipkart.com/dl/littmann-3m-classic-ii-s-e-acoustic-stethoscope/p/itme3uhzbqxhzfda?pid=sthdrnfkaqfafye8&affid=3ba0de4902524e2b90e43b84b89ea0ef', 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM