resources.wrappers.FileJsonPyTorch.gate-lf-pytorch-json.gatelfpytorchjson.utils.py 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.
"""Various commonly used utility functions"""
import argparse
# The way how argparse treats boolean arguments sucks, so we need to do this
def str2bool(val):
val = str(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,))