Commit 1068de51 authored by Neeme Kahusk's avatar Neeme Kahusk

test filtering

parent ceb9b8b7
......@@ -20,6 +20,15 @@ from configure_columns import SIMPLE
XPATHLIST = SIMPLE
def make_filter(tabelifail: str = 'tulbad.csv'):
with open(tabelifail) as tf:
reader = csv.DictReader(tf, dialect=csv.excel_tab)
csvdata = [x for x in reader]
labels_et = [x for x in csvdata if x['label_et'] in XPATHLIST]
return labels_et
def get_xpath(root: etree._ElementTree, xpath: str):
namespaces = {'x':'http://www.ilsp.gr/META-XMLSchema'}
elements = root.xpath(xpath, namespaces=namespaces)
......@@ -48,25 +57,15 @@ def main():
args = parser.parse_args()
tabelifail = args.tablefile or 'tulbad.csv'
with open(tabelifail) as tf:
reader = csv.DictReader(tf, dialect=csv.excel_tab)
csvdata = [x for x in reader]
for i in csvdata:
print(i)
labels_et = [x for x in csvdata if x['label_et'] in XPATHLIST]
print(labels_et)
labels = make_filter()
if args.zip:
tulem = zip2roots(args.infile)
for i in tulem:
pass
# print(etree.tounicode(i, pretty_print=True))
print(i)
for t in labels:
print(t)
print(5*'--')
else:
p = Path(args.infile)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment