Spaces:
Running
Running
Upload app.py
Browse files47 unmodified lines484950515253545556575859609 unmodified lines707172737475767778798081828384858687888990919293949547 unmodified lines# journal is in top 15% Scopus (checked via SCImago quartile Q1/Q2 at enrichment).# Always shown with "verify eligibility" caveat β not a guarantee.KU_APC_PUBLISHER_GROUPS = [{"american chemical society", "acs publications", "acs"},{"elsevier", "elsevier bv", "elsevier inc"},{"ieee", "institute of electrical and electronics engineers", "ieee press"},{"springer", "springer nature", "springernature", "springer-nature","nature portfolio", "nature publishing"},{"taylor & francis", "taylor and francis", "routledge", "informa"},{"wiley", "wiley-blackwell", "john wiley", "wiley online"},]def is_ku_apc_covered(publisher: str, quartile: str = "") -> bool:9 unmodified lines# Must be Q1 β strictlyif quartile != "Q1":return False# Robust publisher matching:# 1. All alias words must appear in publisher string (alias is subset of pub)# 2. OR publisher is an exact aliaspub_norm = pub.replace("-", " ").replace("&", "and")pub_words = set(pub_norm.split())for group in KU_APC_PUBLISHER_GROUPS:for alias in group:alias_norm = alias.replace("-", " ").replace("&", "and")alias_words = set(alias_norm.split())# Exact matchif pub_norm == alias_norm:return True# All alias words found in pub (handles "elsevier bv" β pub contains both words)if len(alias_words) > 1 and alias_words.issubset(pub_words):return True# Single-word alias: must be exact word in publisherif len(alias_words) == 1:word = list(alias_words)[0]if word in pub_words and len(pub_words) <= len(alias_words) + 2:return Truereturn False# ββ Rate limiter β sliding window in-memory ββββββββββββββββββββββββββββββββ47 unmodified lines4849505152535455565758596061626364656667686970717273747576777879809 unmodified lines9091929394959697989910010110210310410510610710810911011111211311411511611711847 unmodified lines# journal is in top 15% Scopus (checked via SCImago quartile Q1/Q2 at enrichment).# Always shown with "verify eligibility" caveat β not a guarantee.KU_APC_PUBLISHER_GROUPS = [# ACS{"american chemical society"},# Elsevier β all regional entities{"elsevier", "elsevier b.v.", "elsevier bv", "elsevier ltd", "elsevier inc.","elsevier inc", "elsevier ireland ltd", "elsevier gmbh", "elsevier masson","elsevier singapore", "elsevier australia", "elsevier beijing","elsevier editora", "elsevier espana"},# IEEE β all society variants{"ieee", "ieee advancing technology", "ieee communications society","ieee computational intelligence", "ieee computer society","ieee electron devices", "ieee microwave"},# Springer Nature β all Springer variants{"springer", "springer nature", "springernature", "nature portfolio","nature publishing", "springer international publishing","springer international publishing ag", "springer berlin", "springer boston","springer china", "springer netherlands", "springer new york","springer london", "springer japan", "springer verlag","springer science and business media", "springer publishing"},# Taylor & Francis β all T&F variants (note: & in SCImago CSV){"taylor and francis", "taylor & francis", "taylor & francis","routledge", "routledge, taylor", "taylor and francis ltd","taylor and francis inc", "taylor and francis a.s","taylor and francis asia pacific"},# Wiley β all Wiley variants{"wiley", "wiley-blackwell", "wiley-blackwell publishing","john wiley and sons", "john wiley & sons", "john wiley & sons","wiley-liss", "wiley-vch", "wiley - vch"},]def is_ku_apc_covered(publisher: str, quartile: str = "") -> bool:9 unmodified lines# Must be Q1 β strictlyif quartile != "Q1":return False# Normalize: strip HTML entities, punctuation variantsdef norm(s):return (s.lower().replace("&", "&").replace("&", "and").replace(".", "").replace(",", "").replace("-", " ").strip())pub_norm = norm(pub)pub_words = set(pub_norm.split())for group in KU_APC_PUBLISHER_GROUPS:for alias in group:alias_norm = norm(alias)alias_words = set(alias_norm.split())# Exact matchif pub_norm == alias_norm:return True# Pub starts with alias (e.g. "elsevier ireland ltd" starts with "elsevier")if pub_norm.startswith(alias_norm):return True# Multi-word alias: all alias words in pubif len(alias_words) > 1 and alias_words.issubset(pub_words):return Truereturn False# ββ Rate limiter β sliding window in-memory ββββββββββββββββββββββββββββββββ
app.py+41-18