Exemple #1
0
            del elem.attrib[attr]


def remove_elem(elem, parent):
    try:
        parent.remove(elem)
    except AttributeError:
        # parent is None because this is the root elem,
        # which cannot be removed
        pass


strip_methods = dict(default=strip_elem_default, minimal=strip_elem_minimal)

parser = ArgumentParser(description=__doc__,
                        version="%(prog)s version " + __version__,
                        formatter_class=RawDescriptionHelpFormatter)

parser.add_argument("file",
                    help="xml file specifying lexical units or synsets")

parser.add_argument("--method",
                    "-m",
                    choices=["default", "minimal"],
                    default="default",
                    help="method of stripping")

args = parser.parse_args()

strip(args.file, strip_methods[args.method])
Exemple #2
0
import sys

try:
    import cornetto
except ImportError, inst:
    print >> sys.stderr, inst
    print >> sys.stderr, "Did you properly install Pycornetto using 'setup.py install' ?"
    exit(1)

import webbrowser
import os

from cornetto.argparse import ArgumentParser

parser = ArgumentParser(description=__doc__,
                        version="%(prog)s version " + __version__)

parser.add_argument(
    "-l",
    "--location",
    default=False,
    action='store_true',
    help='just show where the documention is located on your system')

args = parser.parse_args()

# note that we cannot rely on sys.prefix, because pycornetto may be installed
# in a non.standard location
docpath = os.path.join(
    os.path.dirname(cornetto.__file__),
    "..",  # skip cornetto package dir