resources.wrappers.FileJsonPyTorch.gate-lf-pytorch-json.docs.pythondoc._modules.gatelfpytorchjson.utils.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of learningframework Show documentation
Show all versions of learningframework Show documentation
A GATE plugin that provides many different machine learning
algorithms for a wide range of NLP-related machine learning tasks like
text classification, tagging, or chunking.
gatelfpytorchjson.utils — GATE LF Pytorch Wrapper (gatelfpytorch) documentation
Source code for gatelfpytorchjson.utils
"""Various commonly used utility functions"""
import argparse
# The way how argparse treats boolean arguments sucks, so we need to do this
[docs]def str2bool(val):
if val.lower() in ["yes", "true", "y", "t", "1"]:
return True
elif val.lower() in ["no", "false", "n", "f", "0"]:
return False
else:
raise argparse.ArgumentTypeError("Boolean value expected, not %s" % (val,))