reconlicer: Move match thresholds to top of module
This commit is contained in:
parent
93d102539a
commit
a4bba120eb
1 changed files with 9 additions and 6 deletions
|
@ -79,6 +79,11 @@ Other related problems we're not dealing with here:
|
||||||
- transactions are entered manually and reconciled after the fact, but
|
- transactions are entered manually and reconciled after the fact, but
|
||||||
importing from statements may be useful in some cases
|
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:
|
Future possibilities:
|
||||||
|
|
||||||
- allow the reconciler to respect manually-applied metadata - not clear how
|
- allow the reconciler to respect manually-applied metadata - not clear how
|
||||||
|
@ -90,10 +95,6 @@ Future possibilities:
|
||||||
reconciles and summarises the unreconciled transactions
|
reconciles and summarises the unreconciled transactions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# - entry_point seems to swallow errors
|
|
||||||
# - extract the magic numbers
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import collections
|
import collections
|
||||||
import copy
|
import copy
|
||||||
|
@ -150,6 +151,8 @@ JUNK_WORDS = [
|
||||||
]
|
]
|
||||||
JUNK_WORDS_RES = [re.compile(word, re.IGNORECASE) for word in JUNK_WORDS]
|
JUNK_WORDS_RES = [re.compile(word, re.IGNORECASE) for word in JUNK_WORDS]
|
||||||
ZERO_RE = re.compile('^0+')
|
ZERO_RE = re.compile('^0+')
|
||||||
|
FULL_MATCH_THRESHOLD = 0.8
|
||||||
|
PARTIAL_MATCH_THRESHOLD = 0.4
|
||||||
|
|
||||||
|
|
||||||
def remove_duplicate_words(text: str) -> str:
|
def remove_duplicate_words(text: str) -> str:
|
||||||
|
@ -352,9 +355,9 @@ def records_match(r1: Dict, r2: Dict) -> Tuple[float, List[str]]:
|
||||||
else:
|
else:
|
||||||
check_score = 0.0
|
check_score = 0.0
|
||||||
payee_score = payee_match(r1['payee'], r2['payee'])
|
payee_score = payee_match(r1['payee'], r2['payee'])
|
||||||
if payee_score > 0.8:
|
if payee_score > FULL_MATCH_THRESHOLD:
|
||||||
payee_message = ''
|
payee_message = ''
|
||||||
elif payee_score > 0.4:
|
elif payee_score > PARTIAL_MATCH_THRESHOLD:
|
||||||
payee_message = 'partial payee match'
|
payee_message = 'partial payee match'
|
||||||
else:
|
else:
|
||||||
payee_message = 'payee mismatch'
|
payee_message = 'payee mismatch'
|
||||||
|
|
Loading…
Reference in a new issue