Changeset - a4bba120eb37
[Not reviewed]
0 1 0
Ben Sturmfels (bsturmfels) - 16 months ago 2023-02-11 03:53:30
ben@sturm.com.au
reconlicer: Move match thresholds to top of module
1 file changed with 9 insertions and 6 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reconcile/statement_reconciler.py
Show inline comments
...
 
@@ -80,4 +80,9 @@ Other related problems we're not dealing with here:
 
   importing from statements may be useful in some cases
 

	
 
Current issue:
 

	
 
 - entry_point seems to swallow errors, meaning you get a fairly unhelpful
 
   message if there's an unhandled error
 

	
 
Future possibilities:
 

	
...
 
@@ -91,8 +96,4 @@ Future possibilities:
 
"""
 

	
 
# TODO:
 
#  - entry_point seems to swallow errors
 
#  - extract the magic numbers
 

	
 
import argparse
 
import collections
...
 
@@ -151,4 +152,6 @@ JUNK_WORDS = [
 
JUNK_WORDS_RES = [re.compile(word, re.IGNORECASE) for word in JUNK_WORDS]
 
ZERO_RE = re.compile('^0+')
 
FULL_MATCH_THRESHOLD = 0.8
 
PARTIAL_MATCH_THRESHOLD = 0.4
 

	
 

	
...
 
@@ -353,7 +356,7 @@ def records_match(r1: Dict, r2: Dict) -> Tuple[float, List[str]]:
 
        check_score = 0.0
 
        payee_score = payee_match(r1['payee'], r2['payee'])
 
        if payee_score > 0.8:
 
        if payee_score > FULL_MATCH_THRESHOLD:
 
            payee_message = ''
 
        elif payee_score > 0.4:
 
        elif payee_score > PARTIAL_MATCH_THRESHOLD:
 
            payee_message = 'partial payee match'
 
        else:
0 comments (0 inline, 0 general)