@Override public String transform(net.sf.extjwnl.data.POS pos) { return pos.getKey(); } }
/** * Return the <code>POS</code> whose key matches <var>key</var>, * or null if the key does not match any POS. * * @param key POS key * @return POS */ public static POS getPOSForKey(char key) { if (key == NOUN.getKey().charAt(0)) { return POS.NOUN; } if (key == VERB.getKey().charAt(0)) { return POS.VERB; } if (key == ADJECTIVE.getKey().charAt(0)) { return POS.ADJECTIVE; } if (key == ADVERB.getKey().charAt(0)) { return POS.ADVERB; } if (key == ADJECTIVE_SATELLITE_KEY.charAt(0)) { return POS.ADJECTIVE; } return null; }
/** * Return the <code>POS</code> whose key matches <var>key</var>, * or null if the key does not match any POS. * * @param key key for POS * @return POS */ public static POS getPOSForKey(String key) { if (NOUN.getKey().equals(key)) { return POS.NOUN; } if (VERB.getKey().equals(key)) { return POS.VERB; } if (ADJECTIVE.getKey().equals(key)) { return POS.ADJECTIVE; } if (ADVERB.getKey().equals(key)) { return POS.ADVERB; } if (ADJECTIVE_SATELLITE_KEY.equals(key)) { return POS.ADJECTIVE; } return null; }
/** * Return the <code>POS</code> whose key matches <var>key</var>, * or null if the key does not match any POS. * * @param key key for POS * @return POS */ public static POS getPOSForKey(String key) { if (NOUN.getKey().equals(key)) { return POS.NOUN; } if (VERB.getKey().equals(key)) { return POS.VERB; } if (ADJECTIVE.getKey().equals(key)) { return POS.ADJECTIVE; } if (ADVERB.getKey().equals(key)) { return POS.ADVERB; } if (ADJECTIVE_SATELLITE_KEY.equals(key)) { return POS.ADJECTIVE; } return null; }
/** * Return the <code>POS</code> whose key matches <var>key</var>, * or null if the key does not match any POS. * * @param key POS key * @return POS */ public static POS getPOSForKey(char key) { if (key == NOUN.getKey().charAt(0)) { return POS.NOUN; } if (key == VERB.getKey().charAt(0)) { return POS.VERB; } if (key == ADJECTIVE.getKey().charAt(0)) { return POS.ADJECTIVE; } if (key == ADVERB.getKey().charAt(0)) { return POS.ADVERB; } if (key == ADJECTIVE_SATELLITE_KEY.charAt(0)) { return POS.ADJECTIVE; } return null; }
public static HashMap<String, Object> getStemCache() { if (stemCache == null || stemCache.keySet().isEmpty()) { stemCache = new HashMap<String, Object>(); for (Object pos : POS.getAllPOS()) { stemCache.put(((POS) pos).getKey(), new HashMap()); } } return stemCache; }
/** * 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"); } }
protected Query createPOSQuery(POS pos, String sql) throws SQLException { Query query = null; try { query = connectionManager.getQuery(sql); query.getStatement().setString(1, pos.getKey()); return query; } catch (SQLException e) { if (query != null) { query.close(); } throw e; } }
protected Query createPOSQuery(POS pos, String sql) throws SQLException { Query query = null; try { query = connectionManager.getQuery(sql); query.getStatement().setString(1, pos.getKey()); return query; } catch (SQLException e) { if (query != null) { query.close(); } throw e; } }
/** * 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"); } }
protected Query createPOSIdQuery(POS pos, int id, String sql) throws SQLException { Query query = null; try { query = connectionManager.getQuery(sql); query.getStatement().setString(1, pos.getKey()); query.getStatement().setInt(2, id); return query; } catch (SQLException e) { if (query != null) { query.close(); } throw e; } }
iwStmt.setInt(1, id); iwStmt.setString(2, iw.getLemma()); iwStmt.setString(3, iw.getPOS().getKey()); iwStmt.addBatch(); idToSynsetOffset.put(id, iw.getSynsetOffsets());
iwStmt.setInt(1, id); iwStmt.setString(2, iw.getLemma()); iwStmt.setString(3, iw.getPOS().getKey()); iwStmt.addBatch(); idToSynsetOffset.put(id, iw.getSynsetOffsets());
protected Query createPOSStringQuery(POS pos, String str, String sql) throws SQLException { Query query = null; try { query = connectionManager.getQuery(sql); query.getStatement().setString(1, pos.getKey()); query.getStatement().setString(2, str); return query; } catch (SQLException e) { if (query != null) { query.close(); } throw e; } }
protected Query createPOSOffsetQuery(POS pos, long offset, String sql) throws SQLException { Query query = null; try { query = connectionManager.getQuery(sql); query.getStatement().setString(1, pos.getKey()); query.getStatement().setLong(2, offset); return query; } catch (SQLException e) { if (query != null) { query.close(); } throw e; } }
protected Query createPOSIdQuery(POS pos, int id, String sql) throws SQLException { Query query = null; try { query = connectionManager.getQuery(sql); query.getStatement().setString(1, pos.getKey()); query.getStatement().setInt(2, id); return query; } catch (SQLException e) { if (query != null) { query.close(); } throw e; } }
protected Query createPOSStringQuery(POS pos, String str, String sql) throws SQLException { Query query = null; try { query = connectionManager.getQuery(sql); query.getStatement().setString(1, pos.getKey()); query.getStatement().setString(2, str); return query; } catch (SQLException e) { if (query != null) { query.close(); } throw e; } }
protected Query createPOSOffsetQuery(POS pos, long offset, String sql) throws SQLException { Query query = null; try { query = connectionManager.getQuery(sql); query.getStatement().setString(1, pos.getKey()); query.getStatement().setLong(2, offset); return query; } catch (SQLException e) { if (query != null) { query.close(); } throw e; } }
throws SenseInventoryException String lemmaKey = sod + "/" + pos.getKey(); List<String> senses = senseKeyMap.get(lemmaKey); if (senses != null) {
result.append(indexWord.getPOS().getKey()).append(' '); // pos result.append(indexWord.getSenses().size()).append(' '); // synset_cnt result.append(pointerTypes.size()).append(' '); // p_cnt