Skip to content

utils

allennlp_models.vision.dataset_readers.utils

[SOURCE]


Utilities for vision dataset readers.

contractions#

contractions = {
    "aint": "ain't",
    "arent": "aren't",
    "cant": "can't",
    "couldve": "could've",
    "c ...

manual_map#

manual_map = {
    "none": "0",
    "zero": "0",
    "one": "1",
    "two": "2",
    "three": "3",
    "four": "4 ...

articles#

articles = ["a", "an", "the"]

period_strip#

period_strip = re.compile(r"(?!<=\d)(\.)(?!\d)")

comma_strip#

comma_strip = re.compile(r"(\d)(\,)(\d)")

punct#

punct = [
    ";",
    r"/",
    "[",
    "]",
    '"',
    "{",
    "}",
    "(",
    ")",
    "=",
    "+" ...

process_punctuation#

def process_punctuation(inText: str) -> str

process_digit_article#

def process_digit_article(input: str) -> str

preprocess_answer#

@lru_cache(maxsize=None)
def preprocess_answer(answer: str) -> str

get_data_slice#

def get_data_slice(file_path: str) -> Tuple[slice, str]