#!/usr/bin/env python

"""

Author: M. Yassine Karimi
Date: September the 9th, 2015
Title: Layer Checker version 2.0
version#: 1
Description: A script that returns the layers that are in the output file (generated by the pipeline)
VU University Amsterdam

"""

import os
import sys
import glob   
import csv 
import lxml
import itertools
from os import listdir
sys.path.append('/locaton/of/my/KafNafParser')
from KafNafParserMod import *


for files in os.listdir('input/'):
	processed_biography = KafNafParser('input/'+files)   

	if processed_biography.tree:
		tree = 'yes'
	else:
		tree = 'no'

	if processed_biography.root:
		root = 'yes'
	else:
		root = 'no'

	if processed_biography.type:
		type_ = 'yes'
	else:
		type_ = 'no'

	if processed_biography.header:
		header = 'yes'
	else:
		header = 'no'

	if processed_biography.text_layer:
		text_layer = 'yes'
	else:
		text_layer = 'no'

	if processed_biography.term_layer:
		term_layer = 'yes'
	else:
		term_layer = 'no'

	if processed_biography.entity_layer:
		entity_layer = 'yes'
	else:
		entity_layer = 'no'

	if processed_biography.features_layer:
		features_layer = 'yes'
	else:
		features_layer = 'no'

	if processed_biography.opinion_layer:
		opinion_layer = 'yes'
	else:
		opinion_layer = 'no'

	if processed_biography.constituency_layer:
		constituency_layer = 'yes'
	else:
		constituency_layer = 'no'

	if processed_biography.dependency_layer:
		dependency_layer = 'yes'
	else:
		dependency_layer = 'no'

	if processed_biography.coreference_layer:
		coreference_layer = 'yes'
	else:
		coreference_layer = 'no'

	if processed_biography.srl_layer:
		srl_layer = 'yes'
	else:
		srl_layer = 'no'

	if processed_biography.raw:
		raw = 'yes'
	else:
		raw = 'no'

	if processed_biography.timex_layer:
		timex_layer = 'yes'
	else:
		timex_layer = 'no'

	if processed_biography.causalRelations_layer:
		causalRelations_layer = 'yes'
	else:
		causalRelations_layer = 'no'

	if processed_biography.temporalRelations_layer:
		temporalRelations_layer = 'yes'
	else:
		temporalRelations_layer = 'no'

	if processed_biography.factuality_layer:		
		factuality_layer = 'yes'
	else:
		factuality_layer = 'no'

	if processed_biography.my_dependency_extractor:
		my_dependency_extractor = 'yes'
	else:
		my_dependency_extractor = 'no'

	if processed_biography.my_constituency_extractor:
		my_constituency_extractor = 'yes'
	else:
		my_constituency_extractor = 'no'

	if processed_biography.dict_tokens_for_tid:
		dict_tokens_for_tid = 'yes'
	else:
		dict_tokens_for_tid = 'no'

	if processed_biography.terms_for_token:
		terms_for_token = 'yes'
	else:
		terms_for_token = 'no'

	if processed_biography.lang:
		lang = 'yes'
	else:
		lang = 'no'

	if processed_biography.version:
		version = 'yes'
	else:
		version = 'no'

	print "layer..................present" 
	print "tree...................%s" %(tree) 
	print "root...................%s" %(root)
	print "type...................%s" %(type_)
	print "header.................%s" %(header)  
	print "text...................%s" %(text_layer) 
	print "term...................%s" %(term_layer)
	print "entity.................%s" %(entity_layer) 
	print "features...............%s" %(features_layer) 
	print "opinion................%s" %(opinion_layer) 
	print "constituency...........%s" %(constituency_layer) 
	print "dependency.............%s" %(dependency_layer) 
	print "coreference............%s" %(coreference_layer) 
	print "semantic role labels...%s" %(srl_layer) 
	print "raw text...............%s" %(raw)
	print "time expressions.......%s" %(timex_layer) 
	print "casual relation........%s" %(causalRelations_layer) 
	print "temporal relations.....%s" %(temporalRelations_layer) 
	print "factuality.............%s" %(factuality_layer) 
	print "dependency_extractor...%s" %(my_dependency_extractor) 
	print "constituency extractor.%s" %(my_constituency_extractor)
	print "dict tokens for tid....%s" %(dict_tokens_for_tid)
	print "terms for token........%s" %(terms_for_token) 
	print "lang...................%s" %(lang) 
	print "version................%s" %(version) 

