A copyedit can make a sentence easier to read while changing who meets its threshold. For a narrow research-text review tool, an exact comparison of the raw threshold can expose that change before a human reviews the prose. The example below uses fictional eligibility language and standard-library Python.
Input and check
This example handles one symbolic threshold per line, followed by a decimal value. The pattern is deliberately small. It recognizes ASCII and Unicode variants of the common comparison signs and returns “needs author review” when the input has no single match on either side.
import re
from decimal import Decimal
threshold = re.compile(r"(<=|>=|[≤≥<>])\s*(\d+(?:\.\d+)?)")
operator = {"≤": "<=", "≥": ">="}
def read_threshold(text):
matches = threshold.findall(text)
if len(matches) != 1:
return None
sign, value = matches[0]
return operator.get(sign, sign), Decimal(value)
def compare_threshold(source, candidate):
original = read_threshold(source)
revised = read_threshold(candidate)
if original is None or revised is None:
return "needs author review"
if original != revised:
return f"threshold changed: {original[0]} {original[1]} -> {revised[0]} {revised[1]}"
return "same symbolic threshold"
source = "Participants with scores ≥ 8 were eligible."
for candidate in (
"Eligible participants had scores >= 8.",
"Eligible participants had scores > 8.",
"Participants with high scores were eligible.",
):
print(compare_threshold(source, candidate))
Output
same symbolic threshold
threshold changed: >= 8 -> > 8
needs author review
The middle candidate excludes a score of exactly eight. Keep the original sentence and proposed revision side by side and ask the author to check the actual eligibility definition. The final candidate drops the checkable threshold altogether.
This only compares the operator and number. It leaves scope, units, negation, reference groups, spelled-out comparisons, and clinical interpretation to the reviewer. For example, the same >= 8 beside a different instrument still needs review. Use the result as a row in a revision handoff.
I write with the RigorMed team. These inputs are synthetic. The demo runs locally and uses only the Python standard library regex API.
Top comments (0)