<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>MtasCRMParser.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">MTAS</a> > <a href="index.source.html" class="el_package">mtas.analysis.parser</a> > <span class="el_source">MtasCRMParser.java</span></div><h1>MtasCRMParser.java</h1><pre class="source lang-java linenums">package mtas.analysis.parser; import java.io.IOException; import java.io.Reader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import mtas.analysis.token.MtasTokenCollection; import mtas.analysis.token.MtasTokenIdFactory; import mtas.analysis.util.MtasBufferedReader; import mtas.analysis.util.MtasConfigException; import mtas.analysis.util.MtasConfiguration; import mtas.analysis.util.MtasParserException; /** * The Class MtasCRMParser. */ <span class="nc bnc" id="L32" title="All 2 branches missed.">public class MtasCRMParser extends MtasBasicParser {</span> /** The Constant log. */ <span class="nc" id="L35"> private static final Log log = LogFactory.getLog(MtasCRMParser.class);</span> /** The word type. */ <span class="nc" id="L38"> private MtasParserType<MtasParserMapping<?>> wordType = null;</span> /** The word annotation types. */ <span class="nc" id="L41"> private HashMap<String, MtasParserType<MtasParserMapping<?>>> wordAnnotationTypes = new HashMap<>();</span> /** The crm sentence types. */ <span class="nc" id="L44"> private HashMap<String, MtasParserType<MtasParserMapping<?>>> crmSentenceTypes = new HashMap<>();</span> /** The crm clause types. */ <span class="nc" id="L47"> private HashMap<String, MtasParserType<MtasParserMapping<?>>> crmClauseTypes = new HashMap<>();</span> /** The crm pair types. */ <span class="nc" id="L50"> private HashMap<String, MtasParserType<MtasParserMapping<?>>> crmPairTypes = new HashMap<>();</span> /** The functions. */ <span class="nc" id="L53"> private HashMap<String, HashMap<String, MtasCRMParserFunction>> functions = new HashMap<>();</span> /** The Constant MAPPING_TYPE_CRM_SENTENCE. */ protected static final String MAPPING_TYPE_CRM_SENTENCE = "crmSentence"; /** The Constant MAPPING_TYPE_CRM_CLAUSE. */ protected static final String MAPPING_TYPE_CRM_CLAUSE = "crmClause"; /** The Constant MAPPING_TYPE_CRM_PAIR. */ protected static final String MAPPING_TYPE_CRM_PAIR = "crmPair"; /** The history pair. */ <span class="nc" id="L65"> private HashMap<String, HashMap<String, MtasParserObject>> historyPair = new HashMap<>();</span> /** The pair pattern. */ <span class="nc" id="L68"> Pattern pairPattern = Pattern.compile("^([b|e])([a-z])([0-9]+)$");</span> /** * Instantiates a new mtas CRM parser. * * @param config the config */ public MtasCRMParser(MtasConfiguration config) { <span class="nc" id="L76"> super(config);</span> try { <span class="nc" id="L78"> initParser();</span> // System.out.print(printConfig()); <span class="nc" id="L80"> } catch (MtasConfigException e) {</span> <span class="nc" id="L81"> log.error(e);</span> <span class="nc" id="L82"> }</span> <span class="nc" id="L83"> }</span> /* * (non-Javadoc) * * @see mtas.analysis.parser.MtasParser#initParser() */ @SuppressWarnings("unchecked") @Override protected void initParser() throws MtasConfigException { <span class="nc" id="L93"> super.initParser();</span> <span class="nc bnc" id="L94" title="All 2 branches missed."> if (config != null) {</span> // always word, no mappings <span class="nc" id="L96"> wordType = new MtasParserType<>(MAPPING_TYPE_WORD, null, false);</span> <span class="nc bnc" id="L97" title="All 2 branches missed."> for (int i = 0; i < config.children.size(); i++) {</span> <span class="nc" id="L98"> MtasConfiguration current = config.children.get(i);</span> <span class="nc bnc" id="L99" title="All 2 branches missed."> if (current.name.equals("mappings")) {</span> <span class="nc bnc" id="L100" title="All 2 branches missed."> for (int j = 0; j < current.children.size(); j++) {</span> <span class="nc bnc" id="L101" title="All 2 branches missed."> if (current.children.get(j).name.equals("mapping")) {</span> <span class="nc" id="L102"> MtasConfiguration mapping = current.children.get(j);</span> <span class="nc" id="L103"> String typeMapping = mapping.attributes.get("type");</span> <span class="nc" id="L104"> String nameMapping = mapping.attributes.get("name");</span> <span class="nc bnc" id="L105" title="All 2 branches missed."> if ((typeMapping != null)) {</span> <span class="nc bnc" id="L106" title="All 2 branches missed."> if (typeMapping.equals(MAPPING_TYPE_WORD)) {</span> <span class="nc" id="L107"> MtasCRMParserMappingWordAnnotation m = new MtasCRMParserMappingWordAnnotation();</span> <span class="nc" id="L108"> m.processConfig(mapping);</span> <span class="nc" id="L109"> wordType.addItem(m);</span> <span class="nc bnc" id="L110" title="All 4 branches missed."> } else if (typeMapping.equals(MAPPING_TYPE_WORD_ANNOTATION)</span> && (nameMapping != null)) { <span class="nc" id="L112"> MtasCRMParserMappingWordAnnotation m = new MtasCRMParserMappingWordAnnotation();</span> <span class="nc" id="L113"> m.processConfig(mapping);</span> <span class="nc bnc" id="L114" title="All 2 branches missed."> if (wordAnnotationTypes.containsKey(nameMapping)) {</span> <span class="nc" id="L115"> wordAnnotationTypes.get(nameMapping).addItem(m);</span> } else { <span class="nc" id="L117"> MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(</span> typeMapping, nameMapping, false); <span class="nc" id="L119"> t.addItem(m);</span> <span class="nc" id="L120"> wordAnnotationTypes.put(nameMapping, t);</span> } <span class="nc bnc" id="L122" title="All 2 branches missed."> } else if (typeMapping.equals(MAPPING_TYPE_CRM_SENTENCE)) {</span> <span class="nc" id="L123"> MtasCRMParserMappingCRMSentence m = new MtasCRMParserMappingCRMSentence();</span> <span class="nc" id="L124"> m.processConfig(mapping);</span> <span class="nc bnc" id="L125" title="All 2 branches missed."> if (crmSentenceTypes.containsKey(nameMapping)) {</span> <span class="nc" id="L126"> crmSentenceTypes.get(nameMapping).addItem(m);</span> } else { <span class="nc" id="L128"> MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(</span> MAPPING_TYPE_GROUP, nameMapping, true); <span class="nc" id="L130"> t.addItem(m);</span> <span class="nc" id="L131"> crmSentenceTypes.put(nameMapping, t);</span> } <span class="nc bnc" id="L133" title="All 2 branches missed."> } else if (typeMapping.equals(MAPPING_TYPE_CRM_CLAUSE)) {</span> <span class="nc" id="L134"> MtasCRMParserMappingCRMSentence m = new MtasCRMParserMappingCRMSentence();</span> <span class="nc" id="L135"> m.processConfig(mapping);</span> <span class="nc bnc" id="L136" title="All 2 branches missed."> if (crmClauseTypes.containsKey(nameMapping)) {</span> <span class="nc" id="L137"> crmClauseTypes.get(nameMapping).addItem(m);</span> } else { <span class="nc" id="L139"> MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(</span> MAPPING_TYPE_GROUP, nameMapping, true); <span class="nc" id="L141"> t.addItem(m);</span> <span class="nc" id="L142"> crmClauseTypes.put(nameMapping, t);</span> } <span class="nc bnc" id="L144" title="All 2 branches missed."> } else if (typeMapping.equals(MAPPING_TYPE_CRM_PAIR)) {</span> <span class="nc" id="L145"> MtasCRMParserMappingCRMPair m = new MtasCRMParserMappingCRMPair();</span> <span class="nc" id="L146"> m.processConfig(mapping);</span> <span class="nc bnc" id="L147" title="All 2 branches missed."> if (crmPairTypes.containsKey(nameMapping)) {</span> <span class="nc" id="L148"> crmPairTypes.get(nameMapping).addItem(m);</span> } else { <span class="nc" id="L150"> MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(</span> MAPPING_TYPE_RELATION, nameMapping, true); <span class="nc" id="L152"> t.addItem(m);</span> <span class="nc" id="L153"> crmPairTypes.put(nameMapping, t);</span> } <span class="nc" id="L155"> } else {</span> <span class="nc" id="L156"> throw new MtasConfigException("unknown mapping type "</span> + typeMapping + " or missing name"); } } } } <span class="nc bnc" id="L162" title="All 2 branches missed."> } else if (current.name.equals("functions")) {</span> <span class="nc bnc" id="L163" title="All 2 branches missed."> for (int j = 0; j < current.children.size(); j++) {</span> <span class="nc bnc" id="L164" title="All 2 branches missed."> if (current.children.get(j).name.equals("function")) {</span> <span class="nc" id="L165"> MtasConfiguration function = current.children.get(j);</span> <span class="nc" id="L166"> String nameFunction = function.attributes.get("name");</span> <span class="nc" id="L167"> String typeFunction = function.attributes.get("type");</span> <span class="nc" id="L168"> String splitFunction = function.attributes.get("split");</span> <span class="nc bnc" id="L169" title="All 4 branches missed."> if (nameFunction != null && typeFunction != null) {</span> <span class="nc" id="L170"> MtasCRMParserFunction mtasCRMParserFunction = new MtasCRMParserFunction(</span> typeFunction, splitFunction); <span class="nc bnc" id="L172" title="All 2 branches missed."> if (!functions.containsKey(typeFunction)) {</span> <span class="nc" id="L173"> functions.put(typeFunction,</span> new HashMap<String, MtasCRMParserFunction>()); } <span class="nc" id="L176"> functions.get(typeFunction).put(nameFunction,</span> mtasCRMParserFunction); <span class="nc" id="L178"> MtasConfiguration subCurrent = current.children.get(j);</span> <span class="nc bnc" id="L179" title="All 2 branches missed."> for (int k = 0; k < subCurrent.children.size(); k++) {</span> <span class="nc bnc" id="L180" title="All 2 branches missed."> if (subCurrent.children.get(k).name.equals("condition")) {</span> <span class="nc" id="L181"> MtasConfiguration subSubCurrent = subCurrent.children</span> <span class="nc" id="L182"> .get(k);</span> <span class="nc bnc" id="L183" title="All 2 branches missed."> if (subSubCurrent.attributes.containsKey("value")) {</span> <span class="nc" id="L184"> String[] valuesCondition = subSubCurrent.attributes</span> <span class="nc" id="L185"> .get("value").split(Pattern.quote(","));</span> <span class="nc" id="L186"> ArrayList<MtasCRMParserFunctionOutput> valueOutputList = new ArrayList<>();</span> <span class="nc bnc" id="L187" title="All 2 branches missed."> for (int l = 0; l < subSubCurrent.children.size(); l++) {</span> <span class="nc" id="L188"> if (subSubCurrent.children.get(l).name</span> <span class="nc bnc" id="L189" title="All 2 branches missed."> .equals("output")) {</span> <span class="nc" id="L190"> String valueOutput = subSubCurrent.children</span> <span class="nc" id="L191"> .get(l).attributes.get("value");</span> <span class="nc" id="L192"> String nameOutput = subSubCurrent.children</span> <span class="nc" id="L193"> .get(l).attributes.get("name");</span> <span class="nc bnc" id="L194" title="All 2 branches missed."> if (nameOutput != null) {</span> <span class="nc" id="L195"> MtasCRMParserFunctionOutput o = new MtasCRMParserFunctionOutput(</span> nameOutput, valueOutput); <span class="nc" id="L197"> valueOutputList.add(o);</span> } } } <span class="nc bnc" id="L201" title="All 2 branches missed."> if (!valueOutputList.isEmpty()) {</span> <span class="nc bnc" id="L202" title="All 2 branches missed."> for (String valueCondition : valuesCondition) {</span> <span class="nc" id="L203"> if (mtasCRMParserFunction.output</span> <span class="nc bnc" id="L204" title="All 2 branches missed."> .containsKey(valueCondition)) {</span> <span class="nc" id="L205"> mtasCRMParserFunction.output.get(valueCondition)</span> <span class="nc" id="L206"> .addAll(</span> (Collection<? extends MtasCRMParserFunctionOutput>) valueOutputList <span class="nc" id="L208"> .clone());</span> } else { <span class="nc" id="L210"> mtasCRMParserFunction.output.put(valueCondition,</span> (ArrayList<MtasCRMParserFunctionOutput>) valueOutputList <span class="nc" id="L212"> .clone());</span> } } } } } } } } } } } } <span class="nc" id="L225"> }</span> /* * (non-Javadoc) * * @see mtas.analysis.parser.MtasParser#createTokenCollection(java.io.Reader) */ @Override public MtasTokenCollection createTokenCollection(Reader reader) throws MtasParserException, MtasConfigException { <span class="nc" id="L235"> AtomicInteger position = new AtomicInteger(0);</span> <span class="nc" id="L236"> MtasCRMAncestors unknownAncestors = new MtasCRMAncestors();</span> <span class="nc" id="L238"> Map<String, Set<Integer>> idPositions = new HashMap<>();</span> <span class="nc" id="L239"> Map<String, Integer[]> idOffsets = new HashMap<>();</span> <span class="nc" id="L241"> Map<String, Map<Integer, Set<String>>> updateList = createUpdateList();</span> <span class="nc" id="L242"> Map<String, List<MtasParserObject>> currentList = createCurrentList();</span> <span class="nc" id="L244"> tokenCollection = new MtasTokenCollection();</span> <span class="nc" id="L245"> MtasTokenIdFactory mtasTokenIdFactory = new MtasTokenIdFactory();</span> <span class="nc" id="L246"> try (MtasBufferedReader br = new MtasBufferedReader(reader)) {</span> String line; int currentOffset; <span class="nc" id="L249"> int previousOffset = br.getPosition();</span> MtasParserObject currentObject; <span class="nc" id="L251"> Pattern headerPattern = Pattern.compile("^@ @ @(.*)$");</span> <span class="nc" id="L252"> Pattern regularPattern = Pattern.compile(</span> "^([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)$"); Matcher matcherHeader; <span class="nc" id="L255"> Matcher matcherRegular = null;</span> <span class="nc" id="L256"> Set<MtasParserObject> newPreviousSentence = new HashSet<>();</span> <span class="nc" id="L257"> Set<MtasParserObject> previousSentence = new HashSet<>();</span> <span class="nc" id="L258"> Set<MtasParserObject> newPreviousClause = new HashSet<>();</span> <span class="nc" id="L259"> Set<MtasParserObject> previousClause = new HashSet<>();</span> <span class="nc bnc" id="L260" title="All 2 branches missed."> while ((line = br.readLine()) != null) {</span> <span class="nc" id="L261"> currentOffset = br.getPosition();</span> <span class="nc" id="L262"> matcherHeader = headerPattern.matcher(line.trim());</span> <span class="nc" id="L263"> matcherRegular = regularPattern.matcher(line.trim());</span> <span class="nc bnc" id="L264" title="All 2 branches missed."> if (matcherRegular.matches()) {</span> <span class="nc" id="L265"> newPreviousSentence.clear();</span> <span class="nc bnc" id="L266" title="All 2 branches missed."> for (int i = 4; i < 8; i++) {</span> <span class="nc" id="L267"> List<MtasCRMParserFunctionOutput> functionOutputList = new ArrayList<>();</span> <span class="nc" id="L268"> Set<MtasParserObject> tmpList = processCRMSentence(</span> <span class="nc" id="L269"> mtasTokenIdFactory, String.valueOf(i),</span> <span class="nc" id="L270"> matcherRegular.group((i + 1)), currentOffset,</span> functionOutputList, unknownAncestors, currentList, updateList, idPositions, idOffsets, previousSentence, previousClause); <span class="nc bnc" id="L273" title="All 2 branches missed."> if (tmpList != null) {</span> <span class="nc" id="L274"> newPreviousSentence.addAll(tmpList);</span> } <span class="nc bnc" id="L276" title="All 2 branches missed."> for (MtasCRMParserFunctionOutput functionOutput : functionOutputList) {</span> <span class="nc" id="L277"> tmpList = processCRMSentence(mtasTokenIdFactory,</span> <span class="nc" id="L278"> functionOutput.name, functionOutput.value, currentOffset,</span> functionOutputList, unknownAncestors, currentList, updateList, idPositions, idOffsets, previousSentence, previousClause); <span class="nc bnc" id="L281" title="All 2 branches missed."> if (tmpList != null) {</span> <span class="nc" id="L282"> newPreviousSentence.addAll(tmpList);</span> } <span class="nc" id="L284"> }</span> } <span class="nc bnc" id="L286" title="All 2 branches missed."> if (!newPreviousSentence.isEmpty()) {</span> <span class="nc" id="L287"> previousSentence.clear();</span> <span class="nc" id="L288"> previousSentence.addAll(newPreviousSentence);</span> } <span class="nc" id="L290"> newPreviousClause.clear();</span> <span class="nc bnc" id="L291" title="All 2 branches missed."> for (int i = 4; i < 8; i++) {</span> <span class="nc" id="L292"> ArrayList<MtasCRMParserFunctionOutput> functionOutputList = new ArrayList<>();</span> <span class="nc" id="L293"> Set<MtasParserObject> tmpList = processCRMClause(mtasTokenIdFactory,</span> <span class="nc" id="L294"> String.valueOf(i), matcherRegular.group((i + 1)), currentOffset,</span> functionOutputList, unknownAncestors, currentList, updateList, idPositions, idOffsets, previousClause); <span class="nc bnc" id="L297" title="All 2 branches missed."> if (tmpList != null) {</span> <span class="nc" id="L298"> newPreviousClause.addAll(tmpList);</span> } <span class="nc bnc" id="L300" title="All 2 branches missed."> for (MtasCRMParserFunctionOutput functionOutput : functionOutputList) {</span> <span class="nc" id="L301"> tmpList = processCRMClause(mtasTokenIdFactory,</span> <span class="nc" id="L302"> functionOutput.name, functionOutput.value, currentOffset,</span> functionOutputList, unknownAncestors, currentList, updateList, idPositions, idOffsets, previousClause); <span class="nc bnc" id="L305" title="All 2 branches missed."> if (tmpList != null) {</span> <span class="nc" id="L306"> newPreviousClause.addAll(tmpList);</span> } <span class="nc" id="L308"> }</span> } <span class="nc bnc" id="L310" title="All 2 branches missed."> if (!newPreviousClause.isEmpty()) {</span> <span class="nc" id="L311"> previousClause.clear();</span> <span class="nc" id="L312"> previousClause.addAll(newPreviousClause);</span> } } <span class="nc bnc" id="L316" title="All 4 branches missed."> if (matcherRegular.matches() && !matcherHeader.matches()) {</span> <span class="nc" id="L317"> matcherRegular = regularPattern.matcher(line.trim());</span> <span class="nc bnc" id="L318" title="All 2 branches missed."> if (matcherRegular.matches()) {</span> // regular line - start word <span class="nc" id="L320"> currentObject = new MtasParserObject(wordType);</span> <span class="nc" id="L321"> currentObject.setOffsetStart(previousOffset);</span> <span class="nc" id="L322"> currentObject.setRealOffsetStart(previousOffset);</span> <span class="nc" id="L323"> currentObject.setUnknownAncestorNumber(unknownAncestors.unknown);</span> <span class="nc bnc" id="L324" title="All 2 branches missed."> if (!prevalidateObject(currentObject, currentList)) {</span> <span class="nc" id="L325"> unknownAncestors.unknown++;</span> } else { <span class="nc" id="L327"> int p = position.getAndIncrement();</span> <span class="nc" id="L328"> currentObject.addPosition(p);</span> <span class="nc" id="L329"> currentObject.objectId = "word_" + p;</span> <span class="nc" id="L330"> currentList.get(MAPPING_TYPE_WORD).add(currentObject);</span> <span class="nc" id="L331"> unknownAncestors.unknown = 0;</span> // check for crmPair <span class="nc bnc" id="L333" title="All 2 branches missed."> for (int i = 0; i < 8; i++) {</span> <span class="nc" id="L334"> List<MtasCRMParserFunctionOutput> functionOutputList = new ArrayList<>();</span> <span class="nc" id="L335"> processCRMPair(mtasTokenIdFactory, p, String.valueOf(i),</span> <span class="nc" id="L336"> matcherRegular.group((i + 1)), currentOffset,</span> functionOutputList, unknownAncestors, currentList, updateList, idPositions, idOffsets); <span class="nc bnc" id="L339" title="All 2 branches missed."> for (MtasCRMParserFunctionOutput functionOutput : functionOutputList) {</span> <span class="nc" id="L340"> processCRMPair(mtasTokenIdFactory, p, functionOutput.name,</span> <span class="nc" id="L341"> functionOutput.value, currentOffset, functionOutputList,</span> unknownAncestors, currentList, updateList, idPositions, idOffsets); <span class="nc" id="L344"> }</span> } // compute word annotations <span class="nc bnc" id="L347" title="All 2 branches missed."> for (int i = 0; i < 8; i++) {</span> <span class="nc" id="L348"> ArrayList<MtasCRMParserFunctionOutput> functionOutputList = new ArrayList<>();</span> <span class="nc" id="L349"> functionOutputList</span> <span class="nc" id="L350"> .addAll(processWordAnnotation(mtasTokenIdFactory,</span> <span class="nc" id="L351"> String.valueOf(i), matcherRegular.group((i + 1)),</span> <span class="nc" id="L352"> previousOffset, currentOffset, unknownAncestors,</span> currentList, updateList, idPositions, idOffsets)); <span class="nc bnc" id="L354" title="All 2 branches missed."> for (MtasCRMParserFunctionOutput functionOutput : functionOutputList) {</span> <span class="nc" id="L355"> processWordAnnotation(mtasTokenIdFactory, functionOutput.name,</span> <span class="nc" id="L356"> functionOutput.value, previousOffset, currentOffset,</span> unknownAncestors, currentList, updateList, idPositions, idOffsets); <span class="nc" id="L359"> }</span> } } // finish word <span class="nc bnc" id="L363" title="All 2 branches missed."> if (unknownAncestors.unknown > 0) {</span> <span class="nc" id="L364"> unknownAncestors.unknown--;</span> } else { <span class="nc" id="L366"> currentObject = currentList.get(MAPPING_TYPE_WORD)</span> <span class="nc" id="L367"> .remove(currentList.get(MAPPING_TYPE_WORD).size() - 1);</span> <span class="nc bnc" id="L368" title="All 4 branches missed."> assert unknownAncestors.unknown == 0 : "error in administration "</span> <span class="nc" id="L369"> + currentObject.getType().getName();</span> <span class="nc" id="L370"> currentObject.setText(null);</span> <span class="nc" id="L371"> currentObject.setOffsetEnd(currentOffset - 1);</span> <span class="nc" id="L372"> currentObject.setRealOffsetEnd(currentOffset - 1);</span> // update ancestor groups with position and offset for (MtasParserObject currentGroup : currentList <span class="nc bnc" id="L375" title="All 2 branches missed."> .get(MAPPING_TYPE_GROUP)) {</span> <span class="nc" id="L376"> currentGroup.addPositions(currentObject.getPositions());</span> <span class="nc" id="L377"> currentGroup.addOffsetStart(currentObject.getOffsetStart());</span> <span class="nc" id="L378"> currentGroup.addOffsetEnd(currentObject.getOffsetEnd());</span> <span class="nc" id="L379"> }</span> <span class="nc" id="L380"> idPositions.put(currentObject.getId(),</span> <span class="nc" id="L381"> currentObject.getPositions());</span> <span class="nc" id="L382"> idOffsets.put(currentObject.getId(), currentObject.getOffset());</span> <span class="nc" id="L383"> currentObject.updateMappings(idPositions, idOffsets);</span> <span class="nc" id="L384"> unknownAncestors.unknown = currentObject</span> <span class="nc" id="L385"> .getUnknownAncestorNumber();</span> <span class="nc" id="L386"> computeMappingsFromObject(mtasTokenIdFactory, currentObject,</span> currentList, updateList); } } else { // System.out.println("PROBLEM: " + line); } } <span class="nc" id="L394"> previousOffset = br.getPosition();</span> } <span class="nc" id="L396"> closePrevious(mtasTokenIdFactory, previousSentence, previousOffset,</span> unknownAncestors, currentList, updateList, idPositions, idOffsets); <span class="nc" id="L398"> closePrevious(mtasTokenIdFactory, previousClause, previousOffset,</span> unknownAncestors, currentList, updateList, idPositions, idOffsets); <span class="nc bnc" id="L400" title="All 8 branches missed."> } catch (IOException e) {</span> <span class="nc" id="L401"> log.debug(e);</span> <span class="nc" id="L402"> throw new MtasParserException(e.getMessage());</span> <span class="nc" id="L403"> }</span> // final check <span class="nc" id="L405"> tokenCollection.check(autorepair, makeunique);</span> <span class="nc" id="L406"> return tokenCollection;</span> } /** * Process word annotation. * * @param mtasTokenIdFactory the mtas token id factory * @param name the name * @param text the text * @param previousOffset the previous offset * @param currentOffset the current offset * @param unknownAncestors the unknown ancestors * @param currentList the current list * @param updateList the update list * @param idPositions the id positions * @param idOffsets the id offsets * @return the list * @throws MtasParserException the mtas parser exception * @throws MtasConfigException the mtas config exception */ private List<MtasCRMParserFunctionOutput> processWordAnnotation( MtasTokenIdFactory mtasTokenIdFactory, String name, String text, Integer previousOffset, Integer currentOffset, MtasCRMAncestors unknownAncestors, Map<String, List<MtasParserObject>> currentList, Map<String, Map<Integer, Set<String>>> updateList, Map<String, Set<Integer>> idPositions, Map<String, Integer[]> idOffsets) throws MtasParserException, MtasConfigException { MtasParserType tmpCurrentType; MtasParserObject currentObject; <span class="nc" id="L437"> List<MtasCRMParserFunctionOutput> functionOutputList = new ArrayList<>();</span> <span class="nc bnc" id="L438" title="All 2 branches missed."> if ((tmpCurrentType = wordAnnotationTypes.get(name)) != null) {</span> // start word annotation <span class="nc" id="L440"> currentObject = new MtasParserObject(tmpCurrentType);</span> <span class="nc" id="L441"> currentObject.setRealOffsetStart(previousOffset);</span> <span class="nc" id="L442"> currentObject.addPositions(currentList.get(MAPPING_TYPE_WORD)</span> <span class="nc" id="L443"> .get((currentList.get(MAPPING_TYPE_WORD).size() - 1)).getPositions());</span> <span class="nc" id="L444"> currentObject.setUnknownAncestorNumber(unknownAncestors.unknown);</span> <span class="nc bnc" id="L445" title="All 2 branches missed."> if (!prevalidateObject(currentObject, currentList)) {</span> <span class="nc" id="L446"> unknownAncestors.unknown++;</span> } else { <span class="nc" id="L448"> currentList.get(MAPPING_TYPE_WORD_ANNOTATION).add(currentObject);</span> <span class="nc" id="L449"> unknownAncestors.unknown = 0;</span> } // finish word annotation <span class="nc bnc" id="L452" title="All 2 branches missed."> if (unknownAncestors.unknown > 0) {</span> <span class="nc" id="L453"> unknownAncestors.unknown--;</span> } else { <span class="nc" id="L455"> currentObject = currentList.get(MAPPING_TYPE_WORD_ANNOTATION)</span> <span class="nc" id="L456"> .remove(currentList.get(MAPPING_TYPE_WORD_ANNOTATION).size() - 1);</span> <span class="nc bnc" id="L457" title="All 4 branches missed."> assert unknownAncestors.unknown == 0 : "error in administration "</span> <span class="nc" id="L458"> + currentObject.getType().getName();</span> <span class="nc bnc" id="L459" title="All 2 branches missed."> if (functions.containsKey(MAPPING_TYPE_WORD_ANNOTATION)</span> <span class="nc bnc" id="L460" title="All 4 branches missed."> && functions.get(MAPPING_TYPE_WORD_ANNOTATION).containsKey(name)</span> && text != null) { <span class="nc" id="L462"> MtasCRMParserFunction function = functions</span> <span class="nc" id="L463"> .get(MAPPING_TYPE_WORD_ANNOTATION).get(name);</span> String[] value; <span class="nc bnc" id="L465" title="All 2 branches missed."> if (function.split != null) {</span> <span class="nc" id="L466"> value = text.split(Pattern.quote(function.split));</span> } else { <span class="nc" id="L468"> value = new String[] { text };</span> } <span class="nc bnc" id="L470" title="All 2 branches missed."> for (int c = 0; c < value.length; c++) {</span> <span class="nc bnc" id="L471" title="All 2 branches missed."> if (function.output.containsKey(value[c])) {</span> <span class="nc" id="L472"> functionOutputList.addAll(function.output.get(value[c]));</span> } } } <span class="nc" id="L476"> currentObject.setText(text);</span> <span class="nc" id="L477"> currentObject.setRealOffsetEnd(currentOffset - 1);</span> <span class="nc" id="L478"> idPositions.put(currentObject.getId(), currentObject.getPositions());</span> <span class="nc" id="L479"> idOffsets.put(currentObject.getId(), currentObject.getOffset());</span> // offset always null, so update later with word (should be possible) <span class="nc bnc" id="L481" title="All 2 branches missed."> if ((currentObject.getId() != null)</span> <span class="nc bnc" id="L482" title="All 2 branches missed."> && (!currentList.get(MAPPING_TYPE_WORD).isEmpty())) {</span> <span class="nc" id="L483"> currentList.get(MAPPING_TYPE_WORD)</span> <span class="nc" id="L484"> .get((currentList.get(MAPPING_TYPE_WORD).size() - 1))</span> <span class="nc" id="L485"> .addUpdateableIdWithOffset(currentObject.getId());</span> } <span class="nc" id="L487"> currentObject.updateMappings(idPositions, idOffsets);</span> <span class="nc" id="L488"> unknownAncestors.unknown = currentObject.getUnknownAncestorNumber();</span> <span class="nc" id="L489"> computeMappingsFromObject(mtasTokenIdFactory, currentObject,</span> currentList, updateList); } } <span class="nc" id="L493"> return functionOutputList;</span> } /** * Process CRM sentence. * * @param mtasTokenIdFactory the mtas token id factory * @param name the name * @param text the text * @param currentOffset the current offset * @param functionOutputList the function output list * @param unknownAncestors the unknown ancestors * @param currentList the current list * @param updateList the update list * @param idPositions the id positions * @param idOffsets the id offsets * @param previous the previous * @param previousClause the previous clause * @return the sets the * @throws MtasParserException the mtas parser exception * @throws MtasConfigException the mtas config exception */ private Set<MtasParserObject> processCRMSentence( MtasTokenIdFactory mtasTokenIdFactory, String name, String text, Integer currentOffset, List<MtasCRMParserFunctionOutput> functionOutputList, MtasCRMAncestors unknownAncestors, Map<String, List<MtasParserObject>> currentList, Map<String, Map<Integer, Set<String>>> updateList, Map<String, Set<Integer>> idPositions, Map<String, Integer[]> idOffsets, Set<MtasParserObject> previous, Set<MtasParserObject> previousClause) throws MtasParserException, MtasConfigException { MtasParserType tmpCurrentType; MtasParserObject currentObject; <span class="nc bnc" id="L527" title="All 2 branches missed."> if ((tmpCurrentType = crmSentenceTypes.get(name)) != null) {</span> <span class="nc" id="L528"> String filteredText = text.replaceAll("[^0-9\\-]", "");</span> <span class="nc" id="L529"> currentObject = new MtasParserObject(tmpCurrentType);</span> <span class="nc" id="L530"> currentObject.setUnknownAncestorNumber(unknownAncestors.unknown);</span> <span class="nc" id="L531"> currentObject.setRealOffsetStart(currentOffset);</span> <span class="nc" id="L532"> currentObject.setText(filteredText);</span> <span class="nc bnc" id="L533" title="All 2 branches missed."> if (!prevalidateObject(currentObject, currentList)) {</span> <span class="nc" id="L534"> return new HashSet<>();</span> } else { <span class="nc" id="L536"> closePrevious(mtasTokenIdFactory, previousClause, currentOffset,</span> unknownAncestors, currentList, updateList, idPositions, idOffsets); <span class="nc" id="L538"> closePrevious(mtasTokenIdFactory, previous, currentOffset,</span> unknownAncestors, currentList, updateList, idPositions, idOffsets); <span class="nc" id="L540"> previous.clear();</span> <span class="nc" id="L541"> currentList.get(MAPPING_TYPE_GROUP).add(currentObject);</span> <span class="nc" id="L542"> unknownAncestors.unknown = 0;</span> <span class="nc" id="L543"> return new HashSet<>(Arrays.asList(currentObject));</span> } } <span class="nc" id="L546"> return new HashSet<>();</span> } /** * Process CRM clause. * * @param mtasTokenIdFactory the mtas token id factory * @param name the name * @param text the text * @param currentOffset the current offset * @param functionOutputList the function output list * @param unknownAncestors the unknown ancestors * @param currentList the current list * @param updateList the update list * @param idPositions the id positions * @param idOffsets the id offsets * @param previous the previous * @return the sets the * @throws MtasParserException the mtas parser exception * @throws MtasConfigException the mtas config exception */ private Set<MtasParserObject> processCRMClause( MtasTokenIdFactory mtasTokenIdFactory, String name, String text, Integer currentOffset, List<MtasCRMParserFunctionOutput> functionOutputList, MtasCRMAncestors unknownAncestors, Map<String, List<MtasParserObject>> currentList, Map<String, Map<Integer, Set<String>>> updateList, Map<String, Set<Integer>> idPositions, Map<String, Integer[]> idOffsets, Set<MtasParserObject> previous) throws MtasParserException, MtasConfigException { MtasParserType tmpCurrentType; MtasParserObject currentObject; <span class="nc bnc" id="L579" title="All 2 branches missed."> if ((tmpCurrentType = crmClauseTypes.get(name)) != null) {</span> <span class="nc" id="L580"> String filteredText = text.replaceAll("[^0-9\\-]", "");</span> <span class="nc" id="L581"> currentObject = new MtasParserObject(tmpCurrentType);</span> <span class="nc" id="L582"> currentObject.setUnknownAncestorNumber(unknownAncestors.unknown);</span> <span class="nc" id="L583"> currentObject.setRealOffsetStart(currentOffset);</span> <span class="nc" id="L584"> currentObject.setText(filteredText);</span> <span class="nc bnc" id="L585" title="All 2 branches missed."> if (!prevalidateObject(currentObject, currentList)) {</span> <span class="nc" id="L586"> return new HashSet<>();</span> } else { <span class="nc" id="L588"> closePrevious(mtasTokenIdFactory, previous, currentOffset,</span> unknownAncestors, currentList, updateList, idPositions, idOffsets); <span class="nc" id="L590"> previous.clear();</span> <span class="nc" id="L591"> currentList.get(MAPPING_TYPE_GROUP).add(currentObject);</span> <span class="nc" id="L592"> unknownAncestors.unknown = 0;</span> <span class="nc" id="L593"> return new HashSet<>(Arrays.asList(currentObject));</span> } } <span class="nc" id="L596"> return new HashSet<>();</span> } /** * Close previous. * * @param mtasTokenIdFactory the mtas token id factory * @param previous the previous * @param currentOffset the current offset * @param unknownAncestors the unknown ancestors * @param currentList the current list * @param updateList the update list * @param idPositions the id positions * @param idOffsets the id offsets * @throws MtasParserException the mtas parser exception * @throws MtasConfigException the mtas config exception */ private void closePrevious(MtasTokenIdFactory mtasTokenIdFactory, Set<MtasParserObject> previous, Integer currentOffset, MtasCRMAncestors unknownAncestors, Map<String, List<MtasParserObject>> currentList, Map<String, Map<Integer, Set<String>>> updateList, Map<String, Set<Integer>> idPositions, Map<String, Integer[]> idOffsets) throws MtasParserException, MtasConfigException { <span class="nc bnc" id="L620" title="All 2 branches missed."> for (MtasParserObject previousObject : previous) {</span> <span class="nc" id="L621"> previousObject.setRealOffsetEnd(currentOffset);</span> <span class="nc" id="L622"> idPositions.put(previousObject.getId(), previousObject.getPositions());</span> <span class="nc" id="L623"> idOffsets.put(previousObject.getId(), previousObject.getOffset());</span> <span class="nc" id="L624"> previousObject.updateMappings(idPositions, idOffsets);</span> <span class="nc" id="L625"> unknownAncestors.unknown = previousObject.getUnknownAncestorNumber();</span> <span class="nc" id="L626"> computeMappingsFromObject(mtasTokenIdFactory, previousObject, currentList,</span> updateList); <span class="nc" id="L628"> currentList.get(MAPPING_TYPE_GROUP).remove(previousObject);</span> <span class="nc" id="L629"> }</span> <span class="nc" id="L630"> }</span> /** * Process CRM pair. * * @param mtasTokenIdFactory the mtas token id factory * @param position the position * @param name the name * @param text the text * @param currentOffset the current offset * @param functionOutputList the function output list * @param unknownAncestors the unknown ancestors * @param currentList the current list * @param updateList the update list * @param idPositions the id positions * @param idOffsets the id offsets * @throws MtasParserException the mtas parser exception * @throws MtasConfigException the mtas config exception */ private void processCRMPair(MtasTokenIdFactory mtasTokenIdFactory, int position, String name, String text, Integer currentOffset, List<MtasCRMParserFunctionOutput> functionOutputList, MtasCRMAncestors unknownAncestors, Map<String, List<MtasParserObject>> currentList, Map<String, Map<Integer, Set<String>>> updateList, Map<String, Set<Integer>> idPositions, Map<String, Integer[]> idOffsets) throws MtasParserException, MtasConfigException { MtasParserType tmpCurrentType; MtasParserObject currentObject; <span class="nc bnc" id="L661" title="All 2 branches missed."> if ((tmpCurrentType = crmPairTypes.get(name)) != null) {</span> // get history HashMap<String, MtasParserObject> currentNamePairHistory; <span class="nc bnc" id="L664" title="All 2 branches missed."> if (!historyPair.containsKey(name)) {</span> <span class="nc" id="L665"> currentNamePairHistory = new HashMap<>();</span> <span class="nc" id="L666"> historyPair.put(name, currentNamePairHistory);</span> } else { <span class="nc" id="L668"> currentNamePairHistory = historyPair.get(name);</span> } <span class="nc" id="L670"> Matcher m = pairPattern.matcher(text);</span> <span class="nc bnc" id="L671" title="All 2 branches missed."> if (m.find()) {</span> <span class="nc" id="L672"> String thisKey = m.group(1) + m.group(2);</span> <span class="nc bnc" id="L673" title="All 2 branches missed."> String otherKey = (m.group(1).equals("b") ? "e" : "b") + m.group(2);</span> <span class="nc bnc" id="L674" title="All 2 branches missed."> if (currentNamePairHistory.containsKey(otherKey)) {</span> <span class="nc" id="L675"> currentObject = currentNamePairHistory.remove(otherKey);</span> <span class="nc" id="L676"> currentObject.setText(currentObject.getText() + "+" + text);</span> <span class="nc" id="L677"> currentObject.addPosition(position);</span> <span class="nc" id="L678"> processFunctions(name, text, MAPPING_TYPE_CRM_PAIR,</span> functionOutputList); <span class="nc" id="L680"> currentObject.setRealOffsetEnd(currentOffset + 1);</span> <span class="nc" id="L681"> currentObject.setOffsetEnd(currentOffset + 1);</span> <span class="nc" id="L682"> idPositions.put(currentObject.getId(), currentObject.getPositions());</span> <span class="nc" id="L683"> idOffsets.put(currentObject.getId(), currentObject.getOffset());</span> <span class="nc" id="L684"> currentObject.updateMappings(idPositions, idOffsets);</span> <span class="nc" id="L685"> unknownAncestors.unknown = currentObject.getUnknownAncestorNumber();</span> <span class="nc" id="L686"> computeMappingsFromObject(mtasTokenIdFactory, currentObject,</span> currentList, updateList); } else { <span class="nc" id="L689"> currentObject = new MtasParserObject(tmpCurrentType);</span> <span class="nc" id="L690"> currentObject.setUnknownAncestorNumber(unknownAncestors.unknown);</span> <span class="nc" id="L691"> currentObject.setRealOffsetStart(currentOffset);</span> <span class="nc" id="L692"> currentObject.setOffsetStart(currentOffset);</span> <span class="nc" id="L693"> currentObject.setText(text);</span> <span class="nc" id="L694"> currentObject.addPosition(position);</span> <span class="nc bnc" id="L695" title="All 2 branches missed."> if (!prevalidateObject(currentObject, currentList)) {</span> <span class="nc" id="L696"> unknownAncestors.unknown++;</span> } else { <span class="nc" id="L698"> currentNamePairHistory.put(thisKey, currentObject);</span> <span class="nc" id="L699"> processFunctions(name, text, MAPPING_TYPE_CRM_PAIR,</span> functionOutputList); <span class="nc" id="L701"> currentObject.setRealOffsetEnd(currentOffset + 1);</span> <span class="nc" id="L702"> currentObject.setOffsetEnd(currentOffset + 1);</span> <span class="nc" id="L703"> idPositions.put(currentObject.getId(),</span> <span class="nc" id="L704"> currentObject.getPositions());</span> <span class="nc" id="L705"> idOffsets.put(currentObject.getId(), currentObject.getOffset());</span> // offset always null, so update later with word (should be // possible) <span class="nc bnc" id="L708" title="All 2 branches missed."> if ((currentObject.getId() != null)</span> <span class="nc bnc" id="L709" title="All 2 branches missed."> && (!currentList.get(MAPPING_TYPE_WORD).isEmpty())) {</span> <span class="nc" id="L710"> currentList.get(MAPPING_TYPE_WORD)</span> <span class="nc" id="L711"> .get((currentList.get(MAPPING_TYPE_WORD).size() - 1))</span> <span class="nc" id="L712"> .addUpdateableIdWithOffset(currentObject.getId());</span> } } } } } <span class="nc" id="L721"> }</span> /** * Process functions. * * @param name the name * @param text the text * @param type the type * @param functionOutputList the function output list */ private void processFunctions(String name, String text, String type, List<MtasCRMParserFunctionOutput> functionOutputList) { <span class="nc bnc" id="L733" title="All 6 branches missed."> if (functions.containsKey(type) && functions.get(type).containsKey(name)</span> && text != null) { <span class="nc" id="L735"> MtasCRMParserFunction function = functions.get(type).get(name);</span> String[] value; <span class="nc bnc" id="L737" title="All 2 branches missed."> if (function.split != null) {</span> <span class="nc" id="L738"> value = text.split(Pattern.quote(function.split));</span> } else { <span class="nc" id="L740"> value = new String[] { text };</span> } <span class="nc bnc" id="L742" title="All 2 branches missed."> for (int c = 0; c < value.length; c++) {</span> <span class="nc" id="L743"> boolean checkedEmpty = false;</span> <span class="nc bnc" id="L744" title="All 2 branches missed."> if (value[c].equals("")) {</span> <span class="nc" id="L745"> checkedEmpty = true;</span> } <span class="nc bnc" id="L747" title="All 2 branches missed."> if (function.output.containsKey(value[c])) {</span> <span class="nc" id="L748"> ArrayList<MtasCRMParserFunctionOutput> list = function.output</span> <span class="nc" id="L749"> .get(value[c]);</span> <span class="nc bnc" id="L750" title="All 2 branches missed."> for (MtasCRMParserFunctionOutput listItem : list) {</span> <span class="nc" id="L751"> functionOutputList.add(listItem.create(value[c]));</span> <span class="nc" id="L752"> }</span> } <span class="nc bnc" id="L754" title="All 4 branches missed."> if (!checkedEmpty && function.output.containsKey("")) {</span> <span class="nc" id="L755"> ArrayList<MtasCRMParserFunctionOutput> list = function.output.get("");</span> <span class="nc bnc" id="L756" title="All 2 branches missed."> for (MtasCRMParserFunctionOutput listItem : list) {</span> <span class="nc" id="L757"> functionOutputList.add(listItem.create(value[c]));</span> <span class="nc" id="L758"> }</span> } } } <span class="nc" id="L762"> }</span> /* * (non-Javadoc) * * @see mtas.analysis.parser.MtasParser#printConfig() */ @Override public String printConfig() { <span class="nc" id="L771"> StringBuilder text = new StringBuilder();</span> <span class="nc" id="L772"> text.append("=== CONFIGURATION ===\n");</span> <span class="nc" id="L773"> text.append("type: " + wordAnnotationTypes.size() + " x wordAnnotation");</span> <span class="nc" id="L774"> text.append(printConfigTypes(wordAnnotationTypes));</span> <span class="nc" id="L775"> text.append("=== CONFIGURATION ===\n");</span> <span class="nc" id="L776"> return text.toString();</span> } /** * Prints the config types. * * @param types the types * @return the string */ private String printConfigTypes( HashMap<?, MtasParserType<MtasParserMapping<?>>> types) { <span class="nc" id="L787"> StringBuilder text = new StringBuilder();</span> <span class="nc bnc" id="L788" title="All 2 branches missed."> for (Entry<?, MtasParserType<MtasParserMapping<?>>> entry : types</span> <span class="nc" id="L789"> .entrySet()) {</span> <span class="nc" id="L790"> text.append("- " + entry.getKey() + ": " + entry.getValue().items.size()</span> + " mapping(s)\n"); <span class="nc bnc" id="L792" title="All 2 branches missed."> for (int i = 0; i < entry.getValue().items.size(); i++) {</span> <span class="nc" id="L793"> text.append("\t" + entry.getValue().items.get(i) + "\n");</span> } <span class="nc" id="L795"> }</span> <span class="nc" id="L796"> return text.toString();</span> } /** * The Class MtasCRMAncestors. */ <span class="nc" id="L802"> private static class MtasCRMAncestors {</span> /** The unknown. */ <span class="nc" id="L805"> public int unknown = 0;</span> } /** * The Class MtasCRMParserFunction. */ private static class MtasCRMParserFunction { /** The split. */ public String split; /** The output. */ public Map<String, ArrayList<MtasCRMParserFunctionOutput>> output; /** * Instantiates a new mtas CRM parser function. * * @param type the type * @param split the split */ <span class="nc" id="L825"> public MtasCRMParserFunction(String type, String split) {</span> <span class="nc" id="L826"> this.split = split;</span> <span class="nc" id="L827"> output = new HashMap<>();</span> <span class="nc" id="L828"> }</span> } /** * The Class MtasCRMParserFunctionOutput. */ private class MtasCRMParserFunctionOutput { /** The name. */ public String name; /** The value. */ public String value; /** * Instantiates a new mtas CRM parser function output. * * @param name the name * @param value the value */ <span class="nc" id="L849"> public MtasCRMParserFunctionOutput(String name, String value) {</span> <span class="nc" id="L850"> this.name = name;</span> <span class="nc" id="L851"> this.value = value;</span> <span class="nc" id="L852"> }</span> /** * Creates the. * * @param originalValue the original value * @return the mtas CRM parser function output */ public MtasCRMParserFunctionOutput create(String originalValue) { <span class="nc bnc" id="L861" title="All 2 branches missed."> if (value != null) {</span> <span class="nc" id="L862"> return this;</span> } else { <span class="nc" id="L864"> return new MtasCRMParserFunctionOutput(name, originalValue);</span> } } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { <span class="nc" id="L875"> return "MtasCRMParserFunctionOutput[" + name + "," + value + "]";</span> } } /** * The Class MtasCRMParserMappingWordAnnotation. */ private class MtasCRMParserMappingWordAnnotation extends MtasParserMapping<MtasCRMParserMappingWordAnnotation> { /** * Instantiates a new mtas CRM parser mapping word annotation. */ <span class="nc" id="L888"> public MtasCRMParserMappingWordAnnotation() {</span> <span class="nc" id="L889"> super();</span> <span class="nc" id="L890"> this.position = SOURCE_OWN;</span> <span class="nc" id="L891"> this.realOffset = SOURCE_OWN;</span> <span class="nc" id="L892"> this.offset = SOURCE_ANCESTOR_WORD;</span> <span class="nc" id="L893"> this.type = MAPPING_TYPE_WORD_ANNOTATION;</span> <span class="nc" id="L894"> }</span> /* * (non-Javadoc) * * @see mtas.analysis.parser.MtasParser.MtasParserMapping#self() */ @Override protected MtasCRMParserMappingWordAnnotation self() { <span class="nc" id="L903"> return this;</span> } } /** * The Class MtasCRMParserMappingCRMSentence. */ private class MtasCRMParserMappingCRMSentence extends MtasParserMapping<MtasCRMParserMappingCRMSentence> { /** * Instantiates a new mtas CRM parser mapping CRM sentence. */ <span class="nc" id="L916"> public MtasCRMParserMappingCRMSentence() {</span> <span class="nc" id="L917"> super();</span> <span class="nc" id="L918"> this.position = SOURCE_OWN;</span> <span class="nc" id="L919"> this.realOffset = SOURCE_OWN;</span> <span class="nc" id="L920"> this.offset = SOURCE_OWN;</span> <span class="nc" id="L921"> this.type = MAPPING_TYPE_GROUP;</span> <span class="nc" id="L922"> }</span> /* * (non-Javadoc) * * @see mtas.analysis.parser.MtasBasicParser.MtasParserMapping#self() */ @Override protected MtasCRMParserMappingCRMSentence self() { <span class="nc" id="L931"> return this;</span> } } /** * The Class MtasCRMParserMappingCRMPair. */ private class MtasCRMParserMappingCRMPair extends MtasParserMapping<MtasCRMParserMappingCRMPair> { /** * Instantiates a new mtas CRM parser mapping CRM pair. */ <span class="nc" id="L944"> public MtasCRMParserMappingCRMPair() {</span> <span class="nc" id="L945"> super();</span> <span class="nc" id="L946"> this.position = SOURCE_OWN;</span> <span class="nc" id="L947"> this.realOffset = SOURCE_OWN;</span> <span class="nc" id="L948"> this.offset = SOURCE_OWN;</span> <span class="nc" id="L949"> this.type = MAPPING_TYPE_RELATION;</span> <span class="nc" id="L950"> }</span> /* * (non-Javadoc) * * @see mtas.analysis.parser.MtasBasicParser.MtasParserMapping#self() */ @Override protected MtasCRMParserMappingCRMPair self() { <span class="nc" id="L959"> return this;</span> } } } </pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.9.201702052155</span></div></body></html>