a little more tidying of consoleLabel
@@ -34,7 +34,7 @@ def consoleLabel(deduper): # pragma: no cover
uncertain_pairs = []
while not finished :
- if examples_buffer and use_previous:
+ if use_previous:
record_pair, _ = examples_buffer.pop(0)
use_previous = False
else:
@@ -42,13 +42,10 @@ def consoleLabel(deduper): # pragma: no cover
uncertain_pairs = deduper.uncertainPairs()
record_pair = uncertain_pairs.pop()
- n_match_in_buffer = sum(label=='match' for _, label in examples_buffer)
- n_distinct_in_buffer = sum(label=='distinct' for _, label in examples_buffer)
-
- n_match, n_distinct = (len(deduper.training_pairs['match']) + n_match_in_buffer,
- len(deduper.training_pairs['distinct']) + n_distinct_in_buffer)
-
- label = ''
+ n_match = (len(deduper.training_pairs['match']) +
+ sum(label=='match' for _, label in examples_buffer))
+ n_distinct = (len(deduper.training_pairs['distinct']) +
+ sum(label=='match' for _, label in examples_buffer))
for pair in record_pair:
for field in fields:
@@ -61,6 +58,7 @@ def consoleLabel(deduper): # pragma: no cover
print('Do these records refer to the same thing?', file=sys.stderr)
valid_response = False
+ user_input = ''
while not valid_response:
if examples_buffer:
prompt = '(y)es / (n)o / (u)nsure / (f)inished / (p)revious'
@@ -99,7 +97,7 @@ def consoleLabel(deduper): # pragma: no cover
examples = {'distinct' : [], 'match' : []}
examples[label].append(record_pair)
deduper.markPairs(examples)
-#
+
def trainingDataLink(data_1, data_2, common_key, training_size=50000) : # pragma: nocover
'''
