Package org.maltparserx.core.exception

Examples of org.maltparserx.core.exception.MaltChainedException


          }
          writer.append('\n');
        }
        writer.append('\n');
      } catch (IOException e) {
        throw new MaltChainedException("", e);
      }
      graphCounter++;
    }
    return signal;
  }
View Full Code Here


 
  public void writeToDiaFile(String message) throws MaltChainedException {
    try {
      getDiaWriter().write(message);
    } catch (IOException e) {
      throw new MaltChainedException("Could not write to the diagnostic file. ", e);
    }
  }
View Full Code Here

    if (diaWriter != null) {
      try {
        diaWriter.flush();
        diaWriter.close();
      } catch (IOException e) {
        throw new MaltChainedException("Could not close the diagnostic file. ", e);
      }
    }
  }
View Full Code Here

          diaWriter = new BufferedWriter(new OutputStreamWriter(System.err));
        } else {
          diaWriter = new BufferedWriter(new FileWriter(fileName));
        }
      } catch (IOException e) {
        throw new MaltChainedException("Could not open the diagnostic file. ", e);
      }
    }
  }
View Full Code Here

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

      if (action == null) {
        action = oracleGuide.predict(goldDependencyGraph, currentParserConfiguration);
        try {
          classifierGuide.addInstance((GuideDecision)action);
        } catch (NullPointerException e) {
          throw new MaltChainedException("The guide cannot be found. ", e);
        }
      } else if (diagnostics == true) {
        writeToDiaFile(" *");
      }
      if (diagnostics == true) {
View Full Code Here

        arcLabelActionContainers[i].setAction(-1)
      }
    } else {
      for (int i = 0; i < arcLabelActionContainers.length; i++) {
        if (arcLabelActionContainers[i] == null) {
          throw new MaltChainedException("arcLabelActionContainer " + i + " is null when doing transition " + transition);
        }
       
        Integer code = arcLabels.get(arcLabelActionContainers[i].getTable());
        if (code != null) {
          arcLabelActionContainers[i].setAction(code.shortValue());
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 NegraReader parameter: '"+argv[i-1]+"' with value '"+argv[i]+"'. ");   
      }
View Full Code Here

        }
       
        if (c == -1) {
          if (brackets != 0) {
            close();
            throw new MaltChainedException("Error when reading from the input file. ");
          }
          if (cIterations < nIterations) {
            cIterations++;
            reopen();
            return true;
          }
          return false;
        }
      }
    }  catch (IOException e) {
      close();
      throw new MaltChainedException("Error when reading from the input file. ", e);
    }
   
  }
View Full Code Here

    }
    if (index == -1) {
      TokenNode t = phraseStructure.addTokenNode(terminalCounter);
      if (t == null) {
        close();
        throw new MaltChainedException("Bracket Reader error: could not create a terminal node. ");
      }

      terminalCounter++;
      Edge e = null;

      if (parent != null) {
        e = phraseStructure.addPhraseStructureEdge(parent, (PhraseStructureNode)t);
      } else {
        close();
        throw new MaltChainedException("Bracket Reader error: could not find the parent node. ");
      }

      int start = begin;

      Iterator<String> inputColumnsIterator = inputColumns.keySet().iterator();
      Iterator<String> edgeLabelsColumnsIterator = edgeLabelColumns.keySet().iterator();
      boolean noneNode = false;
      boolean edgeLabels = false;
      for (int i = begin; i < end; i++) {
        if (input.charAt(i) == EDGELABEL_SEPARATOR || (input.charAt(i) == INPUT_SEPARATOR
            // Start BracketProgLangReader
            && (i == begin || input.charAt(i - 1) != '\\')
            // end BracketProgLangReader 
          ) || i == end - 1) {
          if (i == begin && input.charAt(i) == EDGELABEL_SEPARATOR) {
            noneNode = true;
          } else if (start == begin) {
            if ((noneNode && input.charAt(i) != EDGELABEL_SEPARATOR) || !noneNode) {
              if (inputColumnsIterator.hasNext()) {
                t.addLabel(inputColumns.get(inputColumnsIterator.next()).getSymbolTable(),
                   
                    // Start BracketProgLangReader
                    decodeString(
                    // end BracketProgLangReader
                    (i == end - 1)?input.substring(start,end):input.substring(start, i)
                    // Start BracketProgLangReader
                    )
                    // end BracketProgLangReader   
                    );
              }
              start = i + 1;
              if (input.charAt(i) == EDGELABEL_SEPARATOR) {
                edgeLabels = true;
              }
            }
          } else if (edgeLabels && e != null) {
            if (edgeLabelsColumnsIterator.hasNext()) {
              e.addLabel(edgeLabelColumns.get(edgeLabelsColumnsIterator.next()).getSymbolTable(), (i == end - 1)?input.substring(start,end):input.substring(start, i));
            }
            start = i + 1;
            if (input.charAt(i) == INPUT_SEPARATOR
                // Start BracketProgLangReader
                && (i == begin || input.charAt(i - 1) != '\\')
                // end BracketProgLangReader   
            ) {
              edgeLabels = false;
            }
          } else if (input.charAt(i) == EDGELABEL_SEPARATOR && i != end - 1 && (input.charAt(i+1) != INPUT_SEPARATOR
              // Start BracketProgLangReader
              && (i == begin || input.charAt(i - 1) != '\\')
              // end BracketProgLangReader
              )
          ) { 
          } else {
            if (inputColumnsIterator.hasNext()) {
              t.addLabel(inputColumns.get(inputColumnsIterator.next()).getSymbolTable(), (i == end - 1)?input.substring(start,end):input.substring(start, i));
            }
            start = i + 1;
          }
        }
      }
    } else {
      PhraseStructureNode nt;
      Edge e = null;
      if (parent == null) {
        nt = phraseStructure.getPhraseStructureRoot();
      } else {
        nt = phraseStructure.addNonTerminalNode(nonTerminalCounter);
        if (nt == null) {
          close();
          throw new MaltChainedException("Bracket Reader error: could not create a nonterminal node. ");
        }
        nonTerminalCounter++;

        e = phraseStructure.addPhraseStructureEdge(parent, nt);
      }
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.