package pl.edu.icm.coansys.disambiguation.author.pig.extractor;

import org.apache.pig.data.DataBag;
import org.apache.pig.data.DefaultDataBag;
import org.apache.pig.data.TupleFactory;

import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata;
import pl.edu.icm.coansys.models.DocumentProtos.KeywordsList;

public class EX_KEYWORDS implements  DisambiguationExtractor<DataBag>  {
	public DataBag extract(Object o, Object... objects){
		DocumentMetadata dm = (DocumentMetadata) o;
		DataBag db = new DefaultDataBag();
		String lang = null;
		
		for(KeywordsList k : dm.getKeywordsList() ){
			for(String s : 	k.getKeywordsList() ){
				db.add(TupleFactory.getInstance().newTuple(s));
			}
		}
			
		return db;		
	}
}

@@ -548,17 +548,19 @@
 %09%09%0A%09%09for
-(
+ ( 
 Keywords
@@ -598,17 +598,19 @@
 %7B%0A%09%09%09for
-(
+ ( 
 String s
@@ -612,17 +612,16 @@
 ing s : 
-%09
 k.getKey

debug removed