Esempio n. 1
0
def stats(pgc_dir, pgc_files_pattern, with_unaligned_roots=False):
    """
    return statistics tables for all matching parallel graph corpora and 
    associated graph banks
    """
    cwd = getcwd()
    
    # must change to dir of pgc files,
    # because paths to gb files are interpreted relative to location of pgc file 
    try:
        chdir(pgc_dir)
    except OSError:
        # dir does not exist
        # assume there are no files, which results in a empty table
        pgc_files = []
    else:
        pgc_files = glob(pgc_files_pattern)
        
    pgc_table, gb_table = pgc_stats(pgc_files, 
                                    with_unaligned_roots=with_unaligned_roots)

    chdir(cwd)
    
    return  pgc_table, gb_table
Esempio n. 2
0
def stats(pgc_dir, pgc_files_pattern, with_unaligned_roots=False):
    """
    return statistics tables for all matching parallel graph corpora and 
    associated graph banks
    """
    cwd = getcwd()

    # must change to dir of pgc files,
    # because paths to gb files are interpreted relative to location of pgc file
    try:
        chdir(pgc_dir)
    except OSError:
        # dir does not exist
        # assume there are no files, which results in a empty table
        pgc_files = []
    else:
        pgc_files = glob(pgc_files_pattern)

    pgc_table, gb_table = pgc_stats(pgc_files,
                                    with_unaligned_roots=with_unaligned_roots)

    chdir(cwd)

    return pgc_table, gb_table
Esempio n. 3
0

args = parser.parse_args()

files = glob(args.pattern)

if not files:
    exit("pgc_stats.py: warning: no matching files")
    
if args.with_all:
    args.with_empty_nodes = True
    args.with_failed_parses = True
    args.with_punc = True
    args.with_unaligned_roots = True
    args.with_unaligned_graphs = True
    

pgc_table, gb_table = pgc_stats(
    files, 
    with_empty_nodes=args.with_empty_nodes,
    with_failed_parses=args.with_failed_parses,
    with_punc=args.with_punc,
    with_unaligned_roots=args.with_unaligned_roots,
    threshold=args.threshold,
    with_unaligned_graphs=args.with_unaligned_graphs)

pgc_table.write(legenda=args.legenda)
gb_table.write(legenda=args.legenda)


Esempio n. 4
0
                    "--with_unaligned-graphs",
                    action="store_true",
                    dest="with_unaligned_graphs",
                    help="include unaligned graphs")

args = parser.parse_args()

files = glob(args.pattern)

if not files:
    exit("pgc_stats.py: warning: no matching files")

if args.with_all:
    args.with_empty_nodes = True
    args.with_failed_parses = True
    args.with_punc = True
    args.with_unaligned_roots = True
    args.with_unaligned_graphs = True

pgc_table, gb_table = pgc_stats(
    files,
    with_empty_nodes=args.with_empty_nodes,
    with_failed_parses=args.with_failed_parses,
    with_punc=args.with_punc,
    with_unaligned_roots=args.with_unaligned_roots,
    threshold=args.threshold,
    with_unaligned_graphs=args.with_unaligned_graphs)

pgc_table.write(legenda=args.legenda)
gb_table.write(legenda=args.legenda)