/*
 * Copyright (C) 2012 Fabian Hirschmann <fabian@hirschm.net>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package com.github.fhirschmann.clozegen.lib.annotators;

import de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.ART;
import org.apache.uima.jcas.tcas.Annotation;

/**
 * Annotates articles for use in cloze tests.
 *
 * @author Fabian Hirschmann <fabian@hirschm.net>
 */
public class ArticleAnnotator extends GapAnnotator {

    @Override
    public int getType() {
        return ART.type;
    }

    @Override
    public Gap generate(final Annotation subject) {
        Gap gap = new Gap();

        gap.getValidAnswers().add(subject.getCoveredText());
        gap.getInvalidAnswers().add("a");
        gap.getInvalidAnswers().add("an");
        gap.getInvalidAnswers().add("the");

        return gap;
    }
}

@@ -900,16 +900,41 @@
 os.ART;%0A
+import java.util.Arrays;%0A
 import o
@@ -1130,16 +1130,93 @@
 otator %7B
+%0A    public final static String%5B%5D articles = new String%5B%5D %7B%22a%22, %22an%22, %22the%22%7D;
 %0A%0A    @O
@@ -1238,19 +1238,31 @@
 lic 
-int getType
+String%5B%5D getWordClasses
 () %7B
@@ -1281,16 +1281,27 @@
 urn 
-ART.type
+new String%5B%5D %7B%22DT%22%7D
 ;%0A  
@@ -1367,24 +1367,102 @@
  subject) %7B%0A
+        if (Arrays.asList(articles).contains(subject.getCoveredText())) %7B%0A    
         Gap 
@@ -1475,24 +1475,28 @@
 new Gap();%0A%0A
+    
         gap.
@@ -1544,32 +1544,36 @@
 ext());%0A        
+ 
+   
 gap.getInvalidAn
@@ -1586,24 +1586,28 @@
 ).add(%22a%22);%0A
+    
         gap.
@@ -1637,32 +1637,36 @@
 (%22an%22);%0A        
+ 
+   
 gap.getInvalidAn
@@ -1682,24 +1682,28 @@
 dd(%22the%22);%0A%0A
+    
         retu
@@ -1710,16 +1710,47 @@
 rn gap;%0A
+        %7D%0A        return null;%0A
     %7D%0A%7D%0A

make use of the new model