
net.loomchild.segment.srx.io.Srx1Parser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of segment Show documentation
Show all versions of segment Show documentation
Library used to split text into segments.
package net.loomchild.segment.srx.io;
import java.io.Reader;
import java.util.Collections;
import java.util.Map;
import net.loomchild.segment.srx.SrxDocument;
import net.loomchild.segment.srx.SrxParser;
import net.loomchild.segment.srx.SrxTransformer;
/**
* Represents SRX 1.0 parser. Transforms document to SRX 2.0 using
* {@link Srx1Transformer} and then parses it using {@link Srx2Parser}.
*
* @author loomchild
*/
public class Srx1Parser implements SrxParser {
/**
* Transforms document to SRX 2.0 using {@link Srx1Transformer} and default
* transformation parameters and parses it using {@link Srx2Parser}.
*
* @param reader reader from which read the document
* @return initialized SRX document
*/
public SrxDocument parse(Reader reader) {
SrxTransformer transformer = new Srx1Transformer();
Map parameterMap = Collections.emptyMap();
Reader reader2 = transformer.transform(reader, parameterMap);
SrxParser parser2 = new Srx2Parser();
return parser2.parse(reader2);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy