initial abbreviation configurations
This commit is contained in:
parent
b15d260a58
commit
e2b9bcbdbc
|
|
@ -34,14 +34,16 @@ ABB_JSON = dict()
|
|||
|
||||
def get_abb_json():
|
||||
global ABB_JSON
|
||||
with open("abbreviation_records.json", "r") as file:
|
||||
# Load the JSON and convert keys to lowercase
|
||||
ABB_JSON = {key.lower(): value for key, value in json.load(file).items()}
|
||||
if len(ABB_JSON.keys()) == 0:
|
||||
with open("./configuration/aus_prospectus/abbreviation_records.json", "r") as file:
|
||||
# Load the JSON and convert keys to lowercase
|
||||
ABB_JSON = {key.lower(): value for key, value in json.load(file).items()}
|
||||
|
||||
def get_abbre_format_str(fundname):
|
||||
"""Replaces abbreviations in a fund name with their expanded forms."""
|
||||
# Convert fund name to lowercase while matching
|
||||
f_list = fundname.lower().split()
|
||||
get_abb_json()
|
||||
updated_doc_fname_words = [ABB_JSON.get(word, word).lower() for word in f_list]
|
||||
return " ".join(updated_doc_fname_words)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue