001 package org.maltparser.parser.algorithm.covington; 002 003 import org.maltparser.core.exception.MaltChainedException; 004 import org.maltparser.core.syntaxgraph.DependencyStructure; 005 import org.maltparser.parser.SingleMalt; 006 007 /** 008 * 009 * @author Joakim Nivre 010 * @author Johan Hall 011 * @since 1.0 012 */ 013 public class CovingtonProjective extends Covington { 014 015 public CovingtonProjective(SingleMalt configuration) throws MaltChainedException { 016 super(configuration); 017 } 018 019 protected void updateLeft(DependencyStructure dg, int trans) throws MaltChainedException { 020 if (trans == SHIFT || trans == RIGHTARC) { 021 left = leftstop - 1; 022 } else if (trans == NOARC) { 023 if (dg.getTokenNode(input.get(left).getIndex()) != null && dg.getTokenNode(input.get(left).getIndex()).hasHead()) { 024 left = dg.getTokenNode(input.get(left).getIndex()).getHead().getIndex(); 025 } else { 026 left = leftstop - 1; 027 } 028 } else { 029 left--; 030 while (left >= leftstop) { 031 if (input.get(right).findComponent() != input.get(left).findComponent()) { 032 break; 033 } 034 left--; 035 } 036 } 037 } 038 039 public String getName() { 040 return "covproj"; 041 } 042 }