def segment_string(text: str): """ Divides one larger word into segments :param text: :return: """ base = text.lstrip("-") # Replace symbols with their unicode names translated = re.sub("[^[:alpha:]\s\-_]", lambda match: human_readable_translate(match.group()), base) dash_tokens = re.split("[-_ ]", translated) segment_tokens = itertools.chain.from_iterable( [wordsegment.segment(w) for w in dash_tokens]) return [sanitize_token(tok) for tok in segment_tokens]
def reserved(self) -> Set[Tuple[str, ...]]: # Steal the keywords list from miniWDL return {tuple(wordsegment.segment(key)) for key in keywords["1.0"]}
def text(self) -> typing.List[str]: return list( itertools.chain.from_iterable( [wordsegment.segment(name) for name in self.choices] ) )
def get_type(self): t = ( infer_type(" ".join(wordsegment.segment(self.name))) or cli_types.CliString() ) return cli_types.CliList(t)
def text(self) -> typing.List[str]: return list(wordsegment.segment(self.name))
def get_type(self): return infer_type(" ".join(wordsegment.segment(self.name))) or None
def get_type(self): return cli_types.CliTuple( [infer_type(" ".join(wordsegment.segment(arg))) for arg in self.names] )