def argparser():
try:
import argparse
except ImportError:
import compat.argparse as argparse
ap=argparse.ArgumentParser()
ap.add_argument('vectors', nargs=1, metavar='FILE', help='word vectors')
ap.add_argument('-a', '--approximate', default=False, action='store_true',
help='filter by approximate similarity (with -t)')
ap.add_argument('-i', '--min-index', default=0, type=int,
help='index of first word (default 0)')
ap.add_argument('-M', '--metric', default=DEFAULT_METRIC,
choices=sorted(metrics.keys()),
help='distance metric to apply')
ap.add_argument('-n', '--normalize', default=False, action='store_true',
help='normalize vectors to unit length')
ap.add_argument('-r', '--max-rank', metavar='INT', default=None,
type=int, help='only consider r most frequent words')
ap.add_argument('-t', '--threshold', metavar='FLOAT', default=None,
type=float, help='only output distances <= t')
ap.add_argument('-T', '--tolerance', metavar='FLOAT', default=0.1,
type=float, help='approximation tolerace (with -a)')
ap.add_argument('-w', '--whiten', default=False, action='store_true',
help='normalize features to unit variance ')
ap.add_argument('-W', '--words', default=False, action='store_true',
help='output words instead of indices')
return ap
评论列表
文章目录