private void renderException(Exc exc, StringBuilder result) { result.append(exc.getLemma().replace(' ', '_')); for (String e : exc.getExceptions()) { result.append(' ').append(e.replace(' ', '_')); } }
public Exc createException(POS pos, String lemma, List<String> exceptions) throws JWNLException { return new Exc(dictionary, pos, lemma, exceptions); }
/** * Store the exceptions file. * * @param itr iterator * @throws SQLException SQLException */ protected void storeExceptions(Iterator<Exc> itr) throws SQLException { log.info("storing exceptions"); PreparedStatement exStmt = connection.prepareStatement("INSERT INTO exceptions VALUES(?,?,?,?)"); while (itr.hasNext()) { Exc exc = itr.next(); exStmt.setString(4, exc.getLemma()); for (Object o : exc.getExceptions()) { exStmt.setInt(1, nextId()); exStmt.setString(2, exc.getPOS().getKey()); exStmt.setString(3, (String) o); exStmt.addBatch(); } } exStmt.executeBatch(); log.info("stored exceptions"); } }
public Object getKey() { return getLemma(); }
public boolean execute(POS pos, String derivation, BaseFormSet form) throws JWNLException { Exc exc = null == dictionary ? null : dictionary.getException(pos, derivation); if (null != exc) { for (String exception : exc.getExceptions()) { form.add(exception); } return true; } return false; } }
/** * Adds exception to the dictionary. * * @param exc exception to add * @throws JWNLException JWNLException */ public void addException(Exc exc) throws JWNLException { checkEditable(); exc.setDictionary(this); }
/** * Store the exceptions file. * * @param itr iterator * @throws SQLException SQLException */ protected void storeExceptions(Iterator<Exc> itr) throws SQLException { log.info("storing exceptions"); PreparedStatement exStmt = connection.prepareStatement("INSERT INTO exceptions VALUES(?,?,?,?)"); while (itr.hasNext()) { Exc exc = itr.next(); exStmt.setString(4, exc.getLemma()); for (Object o : exc.getExceptions()) { exStmt.setInt(1, nextId()); exStmt.setString(2, exc.getPOS().getKey()); exStmt.setString(3, (String) o); exStmt.addBatch(); } } exStmt.executeBatch(); log.info("stored exceptions"); } }
public Object getKey() { return getLemma(); }
public boolean execute(POS pos, String derivation, BaseFormSet form) throws JWNLException { Exc exc = null == dictionary ? null : dictionary.getException(pos, derivation); if (null != exc) { for (String exception : exc.getExceptions()) { form.add(exception); } return true; } return false; } }
/** * Removes the <var>exc</var> from the dictionary. * * @param exc exc to be removed * @throws JWNLException JWNLException */ public void removeException(Exc exc) throws JWNLException { checkEditable(); exc.setDictionary(null); }
private void renderException(Exc exc, StringBuilder result) { result.append(exc.getLemma().replace(' ', '_')); for (String e : exc.getExceptions()) { result.append(' ').append(e.replace(' ', '_')); } }
public String toString() { StringBuilder str = new StringBuilder(); for (int i = 0; i < exceptions.size(); i++) { str.append(exceptions.get(i)); if (i != exceptions.size() - 1) { str.append(", "); } } return ResourceBundleSet.insertParams("Exc: [Lemma: {0}] Exceptions: {1}]", new Object[]{getLemma(), str.toString()}); } }
final Exc e = d.getException(pos, derivation); if (null != e) { if (null != e.getExceptions()) { if (!e.getExceptions().contains(baseform)) { e.getExceptions().add(baseform); if (i < args.length && '-' != args[i].charAt(0)) { final String baseform = args[i].replace('_', ' '); if (null != e.getExceptions()) { if (e.getExceptions().contains(baseform)) { e.getExceptions().remove(baseform); if (0 == e.getExceptions().size()) { d.removeException(e);
public Exc createException(POS pos, String lemma, List<String> exceptions) throws JWNLException { return new Exc(dictionary, pos, lemma, exceptions); }
/** * Removes the <var>exc</var> from the dictionary. * * @param exc exc to be removed * @throws JWNLException JWNLException */ public void removeException(Exc exc) throws JWNLException { checkEditable(); exc.setDictionary(null); }
public String toString() { StringBuilder str = new StringBuilder(); for (int i = 0; i < exceptions.size(); i++) { str.append(exceptions.get(i)); if (i != exceptions.size() - 1) { str.append(", "); } } return ResourceBundleSet.insertParams("Exc: [Lemma: {0}] Exceptions: {1}]", new Object[]{getLemma(), str.toString()}); } }
final Exc e = d.getException(pos, derivation); if (null != e) { if (null != e.getExceptions()) { if (!e.getExceptions().contains(baseform)) { e.getExceptions().add(baseform); if (i < args.length && '-' != args[i].charAt(0)) { final String baseform = args[i].replace('_', ' '); if (null != e.getExceptions()) { if (e.getExceptions().contains(baseform)) { e.getExceptions().remove(baseform); if (0 == e.getExceptions().size()) { d.removeException(e);