Skip to content

Commit

Permalink
Display how many pairs've been labelled matches and non matches zingg…
Browse files Browse the repository at this point in the history
  • Loading branch information
navinrathore committed Dec 28, 2021
1 parent 614349f commit e9c481d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion core/src/main/java/zingg/Labeller.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class Labeller extends ZinggBase {

protected static String name = "zingg.Labeller";
public static final Log LOG = LogFactory.getLog(Labeller.class);
int positivePairs, negativePairs;

public Labeller() {
setZinggOptions(ZinggOptions.LABEL);
Expand Down Expand Up @@ -96,11 +97,12 @@ public void processRecordsCli(Dataset<Row> lines) throws ZinggClientException {
String msgHeader = msg1 + msg2;

selected_option = displayRecordsAndGetUserInput(DSUtil.select(currentPair, displayCols), msgHeader);
showLabellerStat(selected_option);
if (selected_option == 9) {
LOG.info("User has quit in the middle. Updating the records.");
break;
}
updatedRecords = updateRecords(selected_option, currentPair, updatedRecords);
updatedRecords = updateRecords(selected_option, currentPair, updatedRecords);
}
writeLabelledOutput(updatedRecords);
LOG.warn("Processing finished.");
Expand Down Expand Up @@ -188,6 +190,18 @@ int readCliInput() {
return selection;
}

private void showLabellerStat(int selected_option) {
if (selected_option == ColValues.IS_MATCH_PREDICTION) {
++positivePairs;
}
else if (selected_option == ColValues.IS_NOT_A_MATCH_PREDICTION) {
++negativePairs;
}
System.out.print("\tSo far, " + positivePairs + " pair(s) have been marked " + LabelMatchType.MATCH);
System.out.print(" and " + negativePairs + " pair(s) have been marked " + LabelMatchType.DO_NOT_MATCH);
System.out.println();
}

void writeLabelledOutput(Dataset<Row> records) {
if (records == null) {
LOG.warn("No records to be labelled.");
Expand Down

0 comments on commit e9c481d

Please sign in to comment.