Package net.sourceforge.align.model

Examples of net.sourceforge.align.model.ModelParseException


        String[] parts = line.split("\\s");
        if (parts.length == 2) {
          int wid = Integer.parseInt(parts[0]);
          String word = parts[1];
          if (wid != expectedWid) {
            throw new ModelParseException("Word ordering error");
          }
          vocabulary.putWord(word);
          ++expectedWid;
        } else if (parts.length != 0) {
          throw new ModelParseException("Bad number of " +
              "line parts.");
        }
      }
      return vocabulary;
    } catch (NumberFormatException e) {
      throw new ModelParseException("Part format error", e);
    } catch (IOException e) {
      throw new ModelParseException("IO error", e);
    }
  }
View Full Code Here


        if (parts.length == 2) {
          int wid = Integer.parseInt(parts[0]);
          int count = Integer.parseInt(parts[1]);
          languageModel.addWordOccurence(wid, count);
        } else if (parts.length != 0) {
          throw new ModelParseException("Bad number of line parts.");
        }
      }
      languageModel.normalize();
      return languageModel;
    } catch (NumberFormatException e) {
      throw new ModelParseException("Part format error", e);
    } catch (IOException e) {
      throw new ModelParseException("IO error", e);
    }
  }
View Full Code Here

          MutableSourceData sourceData =
            translationModel.getMutable(sourceWid);
          sourceData.setTranslationProbability(targetWid, probability);
        } else if (parts.length != 0) {
          throw new ModelParseException("Bad number of " +
              "line parts.");
        }
      }
      translationModel.normalize();
      translationModel.sort();
      return translationModel;
    } catch (NumberFormatException e) {
      throw new ModelParseException("Part format error", e);
    } catch (IOException e) {
      throw new ModelParseException("IO error", e);
    }
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.align.model.ModelParseException

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.