Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 
 package eu.clarin.weblicht.wlfxb.tc.test;
 

Author(s):
Yana Panchenko
    private static final String INPUT_FILE_WITHOUT_LAYER = "/data/tc-nes/tcf-before.xml";
    private static final String INPUT_FILE_WITH_LAYER = "/data/tc-nes/tcf-after.xml";
    private static final String EXPECTED_OUTPUT_FILE = "/data/tc-nes/output-expected.xml";
    private static final String OUTPUT_FILE = "/tmp/output.xml";
            EnumSet.of(.);
            EnumSet.of(..);
    public static final Map<StringStringtoken2ne = new HashMap<StringString>();
    static {
        .put("Peter""PERSON");
    }
    @Test
    public void testRead() throws Exception {
        NamedEntitiesLayer layer = tc.getNamedEntitiesLayer();
        Assert.assertEquals(1, layer.size());
        Assert.assertEquals("PERSON"layer.getEntity(0).getType());
        Assert.assertEquals(tc.getTokensLayer().getToken(0), layer.getTokens(layer.getEntity(0))[0]);
    }
    @Test
    public void testReadWrite() throws Exception {
        ..println(tc);
        // create named entities layer, it's empty at first
        NamedEntitiesLayer nes = tc.createNamedEntitiesLayer("MUC1990");
        for (int i = 0; i < tc.getTokensLayer().size(); i++) {
            Token token = tc.getTokensLayer().getToken(i);
            String neType = recognize(token.getString());
            if (neType != null) {
                // create and add part-of-speech tag to the tags layer
                nes.addEntity(neTypetoken);
            }
        }
        // IMPORTANT close the streams!!!
        tc.close();
        ..println(tc);
        // compare output xml with expected xml
    }
    private String recognize(String tokenString) {
        return .get(tokenString);
    }
New to GrepCode? Check out our FAQ X