Package org.maltparserx.core.symbol

Examples of org.maltparserx.core.symbol.SymbolException


    return nullValue2CodeMap.get(nullValueIdentifier);
  }
 
  public String nullvalueToSymbol(NullValueId nullValueIdentifier) throws MaltChainedException {
    if (!nullValue2SymbolMap.containsKey(nullValueIdentifier)) {
      throw new SymbolException("Illegal null-value identifier. ");
    }
    return nullValue2SymbolMap.get(nullValueIdentifier);
  }
View Full Code Here


   * @param code the integer representation of the string value
   * @throws SymbolException
   */
  private void addEntry(TrieSymbolTable table, int code) throws SymbolException {
    if (table == null) {
      throw new SymbolException("Symbol table cannot be found. ");
    }
    if (cachedValueEntry == null) {
      if (code != -1) {
        cachedValueEntry = code; //new TrieEntry(code,true);
        table.updateValueCounter(code);
View Full Code Here

      for (TrieSymbolTable table : symbolTables.values()) {
        table.save(bout);
      }
      bout.close();
    } catch (IOException e) {
      throw new SymbolException("Could not save the symbol tables. ", e);
    }   
  }
View Full Code Here

 
  public void save(String fileName, String charSet) throws MaltChainedException  {
    try {
      save(new OutputStreamWriter(new FileOutputStream(fileName), charSet));
    } catch (FileNotFoundException e) {
      throw new SymbolException("The symbol table file '"+fileName+"' cannot be created. ", e);
    } catch (UnsupportedEncodingException e) {
      throw new SymbolException("The char set '"+charSet+"' is not supported. ", e);
    }
  }
View Full Code Here

        }
        String items[];
        try {
          items = tabPattern.split(fileLine.substring(1));
        } catch (PatternSyntaxException e) {
          throw new SymbolException("The header line of the symbol table  '"+fileLine.substring(1)+"' could not split into atomic parts. ", e);
        }
        if (items.length != 3) {
          throw new SymbolException("The header line of the symbol table  '"+fileLine.substring(1)+"' must contain four columns. ");
        }
        addSymbolTable(items[0], Integer.parseInt(items[1]), items[2]);
      }
    } catch (NumberFormatException e) {
      throw new SymbolException("The symbol table file (.sym) contains a non-integer value in the header. ", e);
    } catch (IOException e) {
      throw new SymbolException("Could not load the symbol table. ", e);
    }
  }
View Full Code Here

          table.load(bin);
        }
      }
      bin.close();
    } catch (IOException e) {
      throw new SymbolException("Could not load the symbol tables. ", e);
    }     
  }
View Full Code Here

  public void load(String fileName, String charSet) throws MaltChainedException  {
    try {
      load(new InputStreamReader(new FileInputStream(fileName), charSet));

    } catch (FileNotFoundException e) {
      throw new SymbolException("The symbol table file '"+fileName+"' cannot be found. ", e);
    } catch (UnsupportedEncodingException e) {
      throw new SymbolException("The char set '"+charSet+"' is not supported. ", e);
    }   
  }
View Full Code Here

      while ((fileLine = br.readLine()) != null) {
        table.addSymbol(fileLine.trim());
      }
      return table;
    } catch (FileNotFoundException e) {
      throw new SymbolException("The tagset file '"+fileName+"' cannot be found. ", e);
    } catch (UnsupportedEncodingException e) {
      throw new SymbolException("The char set '"+charSet+"' is not supported. ", e);
    } catch (IOException e) {
      throw new SymbolException("The tagset file '"+fileName+"' cannot be loaded. ", e);
    }
  }
View Full Code Here

  }
 
  public int addSymbol(String symbol) throws MaltChainedException {
    if (nullValues == null || !nullValues.isNullValue(symbol)) {
      if (symbol == null || symbol.length() == 0) {
        throw new SymbolException("Symbol table error: empty string cannot be added to the symbol table");
      }
     
      if (this.symbolTableMode == TrieSymbolTableHandler.ADD_NEW_TO_TRIE) {
        final TrieNode node = trie.addValue(symbol, this, -1);
        final int code = node.getEntry(this);
View Full Code Here

  }
 
  public int addSymbol(StringBuilder symbol) throws MaltChainedException {
    if (nullValues == null || !nullValues.isNullValue(symbol)) {
      if (symbol == null || symbol.length() == 0) {
        throw new SymbolException("Symbol table error: empty string cannot be added to the symbol table");
      }
     
      if (this.symbolTableMode == TrieSymbolTableHandler.ADD_NEW_TO_TRIE) {
        final TrieNode node = trie.addValue(symbol, this, -1);
        final int code = node.getEntry(this);
View Full Code Here

TOP

Related Classes of org.maltparserx.core.symbol.SymbolException

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.