BodyReader.java
1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package ipipan.clarin.tei.impl.io.read;
import ipipan.clarin.tei.api.entities.AnnotationLayer;
import ipipan.clarin.tei.api.entities.EntitiesFactory;
import ipipan.clarin.tei.api.entities.TEICorpusText;
import ipipan.clarin.tei.api.entities.TEIParagraph;
import ipipan.clarin.tei.api.exceptions.TEIException;
import java.util.Arrays;
import java.util.List;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
/**
*
* @author mlenart
*/
abstract class BodyReader {
protected final List<Integer> ignorables = Arrays.asList(XMLEvent.COMMENT,
XMLEvent.SPACE, XMLEvent.PROCESSING_INSTRUCTION);
protected final EntitiesFactory ef = EntitiesFactory.getInstance();
protected final InWrapper in;
// protected final XMLEventReader eventReader;
protected final String TEI_NS = "http://www.tei-c.org/ns/1.0";
protected BodyReader(InWrapper in) {
this.in = in;
}
static BodyReader create(InWrapper in, AnnotationLayer layer)
throws XMLStreamException {
in.requireStart("body");
switch (layer) {
case SEGMENTATION:
return new SegmentationReader(in);
case MORPHOSYNTAX:
return new MorphosyntaxReader(in);
case NAMES:
return new NamedReader(in);
case WORDS:
return new WordsReader(in);
case GROUPS:
return new GroupsReader(in);
case MENTIONS:
return new MentionsReader(in);
case COREFERENCE:
return new CoreferenceReader(in);
default:
throw new IllegalArgumentException("Illegal argument - " + layer);
}
}
protected void readNextParagraph(TEIParagraph par) throws TEIException {
}
protected void readBody(TEICorpusText text) throws TEIException {
}
}