package edu.fiu.jtlex.data;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import org.junit.jupiter.api.Test;

class TimeMLParserTest {

	@Test
	void test() {
		File folder = new File(System.getProperty("user.dir")+"/data/The TimeBank Corpus");
		File[] tmlFiles = folder.listFiles();
		System.out.println(tmlFiles.length);
		Text[] txtObjects = new Text[tmlFiles.length];
		//int count = 0;
		int i = 0;
		for (File file : tmlFiles) {
			if (file.getName().equals(".DS_Store")) {
				System.out.println(file.getName());
			}
			else {
			System.out.println(file.getName());
			//count++;
			FileInputStream tmlFile = null;
			try {
				tmlFile = new FileInputStream(file);
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
			TimeMLParser parser = new TimeMLParser();
			System.out.println(i);
			txtObjects[i] = (Text) parser.parse(tmlFile);
			}
			i++;
		}
		// not in the same order as it appears in the text
		for(IInstance instance : txtObjects[182].getInstances()) {
			
			System.out.println(instance.getIdStr());
		}
		System.out.println(tmlFiles.length);
	}

}
