Example #1
0
def main():
    global _logger
    args = _cmd.parseArgsForClassOrScript(build_cache)
    varsArgs = vars(args)
    verbosity = varsArgs.pop('verbosity', _util.DEFAULT_VERBOSITY)
    _logger = _util.get_logger(__file__, verbosity=verbosity)
    _logger.info("Passed arguments: '{}'".format(varsArgs))
    build_cache(**varsArgs)
Example #2
0
import os
import pickle
from collections import Sequence
from enum import Enum
from functools import lru_cache
from typing import Union, List, Iterable, Optional

import nltk
import numpy as np
from tqdm import tqdm

import src.utils.cmd_line as _cmd
import src.utils.utility as _util
import src.utils.coco as _coco

_logger = _util.get_logger(__file__)


class Token(Enum):
    """
    Simple Token enum for abstracting common meta tokens.
    """
    START = "<start>"
    END = "<end>"
    PAD = "<pad>"
    UNK = "<unk>"

    def __str__(self):
        return self.value