Ejemplo n.º 1
0
 def setup_class(self):
     self.data_path = 'law_data/InnocentiveYear2005DCTExtract'
     self.xml_file = 'DCTInnoExtY20050420DCTInnoExtY20050420_N_DFEDDISTCV12_2015042064336.nxo.xml'
     self.path = os.path.join(os.getcwd(), self.data_path, self.xml_file)
     self.x = Explorer(self.path)
     print("SETUP!")
Ejemplo n.º 2
0
    along with Docket.  If not, see <http://www.gnu.org/licenses/>.
"""
import os, sys
from docket.explore import Explorer

if __name__ == '__main__':
    # Build the path to the xml file
    data_path = 'law_data/InnocentiveYear2005DCTExtract'
    xml_file = 'DCTInnoExtY20050420DCTInnoExtY20050420_N_DFEDDISTCV12_2015042064336.nxo.xml'
    path = os.path.join(os.getcwd(), data_path, xml_file)

    help_msg = (
        """Usage: $ python -m docket tag-set: The set of all tags\n"""
        """       $ python -m docket grab <tag>: Grabs the text from tag\n""")

    x = Explorer(path)
    numargs = len(sys.argv)

    # Exit if no command line arguments
    if numargs > 1:
        op = sys.argv[1]
    else:
        print(help_msg)
        sys.exit(1)

    if op == 'tag-set':
        print("All Possible Tags:")
        for tag in x.tag_set():
            print(tag)
        sys.exit(0)
    elif op == 'grab':