Package org.maltparserx.core.exception

Examples of org.maltparserx.core.exception.MaltChainedException


          }
          input.setLength(0);
          nNewLines = 0;
          i++;
        } else if (c == TAB) {
          throw new MaltChainedException("The input file '"+fileName+"' contains a column where the value is an empty string. Please check your input file. ");
        }
        if (c == NEWLINE) {
          nNewLines++;
          i = 0;
          columns = dataFormatInstance.iterator();
View Full Code Here


          currentAction = getParserState().getTransitionSystem().defaultAction(parserState.getHistory(), currentParserConfiguration);
          break;
        }
      }
    } catch (NullPointerException e) {
      throw new MaltChainedException("The guide cannot be found. ", e);
    }
    return currentAction;
  }
View Full Code Here

  }
 
  public void process(Object[] arguments) throws MaltChainedException {
    if (mode == LEARN) {
      if (arguments.length < 2 || !(arguments[0] instanceof DependencyStructure) || !(arguments[1] instanceof DependencyStructure)) {
        throw new MaltChainedException("The single malt learn task must be supplied with at least two dependency structures. ");
      }
      DependencyStructure systemGraph = (DependencyStructure)arguments[0];
      DependencyStructure goldGraph = (DependencyStructure)arguments[1];
      if (systemGraph.hasTokens() && getGuide() != null) {
        getGuide().finalizeSentence(((Trainer)getAlgorithm()).parse(goldGraph, systemGraph));
      }
    } else if (mode == PARSE) {
      if (arguments.length < 1 || !(arguments[0] instanceof DependencyStructure)) {
        throw new MaltChainedException("The single malt parse task must be supplied with at least one input terminal structure and one output dependency structure. ");
      }
      DependencyStructure processGraph = (DependencyStructure)arguments[0];
      if (processGraph.hasTokens()) {
        parser.parse(processGraph);
//        ((Parser)getAlgorithm()).parse(processGraph);
View Full Code Here

      switch(argv[i-1].charAt(1)) {
      case 's':
        try {
          START_ID_OF_NONTERMINALS = Integer.parseInt(argv[i]);
        } catch (NumberFormatException e){
          throw new MaltChainedException("The TigerXML Reader option -s must be an integer value. ");
        }
        break;
      default:
        throw new DataFormatException("Unknown TigerXMLReader parameter: '"+argv[i-1]+"' with value '"+argv[i]+"'. ");   
      }
View Full Code Here

    return root;
  }
 
  public Edge addPhraseStructureEdge(PhraseStructureNode parent, PhraseStructureNode child) throws MaltChainedException {
    if (parent == null || child == null) {
      throw new MaltChainedException("Parent or child node is missing in sentence "+getSentenceID());
    } else if (parent.getBelongsToGraph() != this || child.getBelongsToGraph() != this) {
      throw new MaltChainedException("Parent or child node is not a member of the graph in sentence "+getSentenceID());
    } else if (parent == child) {
      throw new MaltChainedException("It is not allowed to add a phrase structure edge connecting the same node in sentence "+getSentenceID());
    } else if (parent instanceof NonTerminalNode && !child.isRoot()) {
      Edge e = edgePool.checkOut();
      e.setBelongsToGraph(this);
      e.setEdge((Node)parent, (Node)child, Edge.PHRASE_STRUCTURE_EDGE);
      graphEdges.add(e);
      return e;
    } else {
      throw new MaltChainedException("Parent or child node is not of correct node type.");
    }
  }
View Full Code Here

        break;
      case 's':
        try {
          START_ID_OF_NONTERMINALS = Integer.parseInt(argv[i]);
        } catch (NumberFormatException e){
          throw new MaltChainedException("The TigerXML writer option -s must be an integer value. ");
        }
        break;
      case 'v':
        VROOT_SYMBOL = argv[i];
        break
View Full Code Here

    super.addLabel(element, labelFunction, label);
  }
 
  public void removePhraseStructureEdge(PhraseStructureNode parent, PhraseStructureNode child) throws MaltChainedException {
    if (parent == null || child == null) {
      throw new MaltChainedException("Parent or child node is missing.");
    } else if (parent instanceof NonTerminalNode && !child.isRoot()) {
      for (Edge e : graphEdges) {
        if (e.getSource() == parent && e.getTarget() == child) {
          e.clear();
          graphEdges.remove(e);
View Full Code Here

          numberOfInstances++;
          owner.increaseFrequency();
        }
        reader.close();
      } catch (IOException e) {
        throw new MaltChainedException("No instances found in file",e);
      }
      return numberOfInstances;
    }
  }
View Full Code Here

          numberOfInstances++;
          owner.increaseFrequency();
        }
        reader.close();
      } catch (IOException e) {
        throw new MaltChainedException("No instances found in file",e);
      }
      return numberOfInstances;
    }
  }
View Full Code Here

    File specFile = this.getFile(specModelFileName);
    if (specFile.exists()) {
      try {
        url = new URL("file:///"+specFile.getAbsolutePath());
      } catch (MalformedURLException e) {
        throw new MaltChainedException("Malformed URL: "+specFile, e);
      }
    } else {
      url = this.getConfigFileEntryURL(specModelFileName);
    }
    return url;
View Full Code Here

TOP

Related Classes of org.maltparserx.core.exception.MaltChainedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.