public MapDictionary(Document doc) throws JWNLException { super(doc); tableMap = new EnumMap<>(POS.class); for (POS pos : POS.values()) { Map<DictionaryFileType, Map<Object, DictionaryElement>> files = new EnumMap<>(DictionaryFileType.class); tableMap.put(pos, files); } }
public MapDictionary(Document doc) throws JWNLException { super(doc); tableMap = new EnumMap<>(POS.class); for (POS pos : POS.values()) { Map<DictionaryFileType, Map<Object, DictionaryElement>> files = new EnumMap<>(DictionaryFileType.class); tableMap.put(pos, files); } }
public MemoryDictionary(Document doc) throws JWNLException { super(doc); for (POS pos : POS.values()) { Map<DictionaryFileType, Map<Object, DictionaryElement>> files = tableMap.get(pos); for (DictionaryFileType type : DictionaryFileType.getAllDictionaryFileTypes()) { Map<Object, DictionaryElement> file = new HashMap<>(); files.put(type, file); } } } }
public AbstractDictionaryElementFactory(Dictionary dictionary, Map<String, Param> params) { this.dictionary = dictionary; if (null != params && params.containsKey(CACHE_STRINGS_KEY)) { cacheStrings = Boolean.parseBoolean(params.get(CACHE_STRINGS_KEY).getValue()); } for (POS pos : POS.values()) { maxOffset.put(pos, 0L); } }
public MemoryDictionary(Document doc) throws JWNLException { super(doc); for (POS pos : POS.values()) { Map<DictionaryFileType, Map<Object, DictionaryElement>> files = tableMap.get(pos); for (DictionaryFileType type : DictionaryFileType.getAllDictionaryFileTypes()) { Map<Object, DictionaryElement> file = new HashMap<>(); files.put(type, file); } } } }
public AbstractDictionaryElementFactory(Dictionary dictionary, Map<String, Param> params) { this.dictionary = dictionary; if (null != params && params.containsKey(CACHE_STRINGS_KEY)) { cacheStrings = Boolean.parseBoolean(params.get(CACHE_STRINGS_KEY).getValue()); } for (POS pos : POS.values()) { maxOffset.put(pos, 0L); } }
protected Set<String> makeBaseFormList(final String example) throws JWNLException { if (morphProcessor == null) morphProcessor = wordnet.getMorphologicalProcessor(); Set<String> result = new TreeSet<String>(); int idx; String remainingString = example; do { idx = remainingString.indexOf(' '); String token; if (idx >= 0) { token = remainingString.substring(0, idx); remainingString = remainingString.substring(idx + 1); } else token = remainingString; // Generate base forms for all POS to avoid POS tagging errors. if (!token.isEmpty()) result.add(token); for (POS pos : POS.values()) result.addAll(morphProcessor.lookupAllBaseForms(pos, token)); } while (idx >= 0); return result; }