Skip to content

Commit

Permalink
Adds --xml-name-regex to anafora.select
Browse files Browse the repository at this point in the history
  • Loading branch information
bethard committed Dec 5, 2014
1 parent 0002e74 commit 3a39b73
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions anafora/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def expand(*args):
return True


def _main(input_dir, output_dir, include=None, exclude=None):
def _main(input_dir, output_dir, xml_name_regex="[.]xml$", include=None, exclude=None):
select = Select(include, exclude)

for sub_dir, text_name, xml_names in anafora.walk(input_dir):
for sub_dir, text_name, xml_names in anafora.walk(input_dir, xml_name_regex):
for xml_name in xml_names:

# reads in the data from the input file
Expand Down Expand Up @@ -91,6 +91,9 @@ def split_tuple_on_colons(string):
parser.add_argument("-o", "--output", metavar="DIR", required=True, dest="output_dir",
help="The directory where the cleaned versions of the Anafora annotation XML files should be " +
"written. The directory structure will mirror the input directory structure.")
parser.add_argument("-x", "--xml-name-regex", metavar="REGEX", default="[.]xml$",
help="A regular expression for matching XML files in the input subdirectories " +
"(default: %(default)r)")
parser.add_argument("--include", metavar="EXPR", nargs="+", type=split_tuple_on_colons,
help="An expression identifying types of annotations to be included in the data. " +
"The expression takes the form type[:property[:value]. For example, TLINK would only " +
Expand Down

0 comments on commit 3a39b73

Please sign in to comment.