public DetachSuffixesOperation(Dictionary dictionary, Map<String, Param> params) throws JWNLException { super(dictionary, params); suffixMap = new EnumMap<>(POS.class); for (Param p : params.values()) { POS pos = POS.getPOSForLabel(p.getName()); if (pos != null) { suffixMap.put(pos, getSuffixArray(dictionary, p.getValue())); } } }
public DetachSuffixesOperation(Dictionary dictionary, Map<String, Param> params) throws JWNLException { super(dictionary, params); suffixMap = new EnumMap<>(POS.class); for (Param p : params.values()) { POS pos = POS.getPOSForLabel(p.getName()); if (pos != null) { suffixMap.put(pos, getSuffixArray(dictionary, p.getValue())); } } }
private void processRecord( String[] r, BiConsumer<InteractionDefinition, Collection<String>> consumer) { if (r.length < 2) { return; } String type = r[0]; String subType = r[1]; if ("Type".equalsIgnoreCase(type) && "Subtype".equalsIgnoreCase(subType)) { // Header, ignore return; } String source = getOrEmpty(r, 2); String target = getOrEmpty(r, 3); String lemma = getOrEmpty(r, 4); POS pos = POS.getPOSForLabel(getOrEmpty(r, 5).toLowerCase()); if (pos == null) { // Can't include words without a POS return; } InteractionDefinition i = new InteractionDefinition(type, subType, new Word(lemma, pos), source, target); List<String> alternatives = new ArrayList<>(r.length - 6); for (int j = 6; j < r.length; j++) { String alternative = r[j].trim(); if (!alternative.isEmpty()) { alternatives.add(alternative); } } consumer.accept(i, alternatives); }
private void processRecord( String[] r, BiConsumer<InteractionDefinition, Collection<String>> consumer) { if (r.length < 2) { return; } String type = r[0]; String subType = r[1]; if ("Type".equalsIgnoreCase(type) && "Subtype".equalsIgnoreCase(subType)) { // Header, ignore return; } String source = getOrEmpty(r, 2); String target = getOrEmpty(r, 3); String lemma = getOrEmpty(r, 4); POS pos = POS.getPOSForLabel(getOrEmpty(r, 5).toLowerCase()); if (pos == null) { // Can't include words without a POS return; } InteractionDefinition i = new InteractionDefinition(type, subType, new Word(lemma, pos), source, target); List<String> alternatives = new ArrayList<>(r.length - 6); for (int j = 6; j < r.length; j++) { String alternative = r[j].trim(); if (!alternative.isEmpty()) { alternatives.add(alternative); } } consumer.accept(i, alternatives); }