public Set<Entity> getEntity(String lexeme) throws LexicalSemanticResourceException { Entity e = new Entity(lexeme); Set<Entity> eSet = new HashSet<Entity>(); eSet.add(e); return eSet; }
@Override public Entity getEntity(Map<String, String> lexemes, PoS pos) throws LexicalSemanticResourceException { return new Entity(lexemes.keySet().iterator().next()); }
public Set<Entity> getEntity(String lexeme) throws LexicalSemanticResourceException { if (!containsLexeme(lexeme)) { return Collections.emptySet(); } // we use a shortcut here, as a lexeme that is contained in Wikipedia always corresponds to a single entity that contains that lexeme Entity e = new Entity(lexeme); Set<Entity> eSet = new HashSet<Entity>(); eSet.add(e); return eSet; }
@Override public Entity getEntity(Map<String, String> lexemes, PoS pos) throws LexicalSemanticResourceException { if (lexemes == null) { return null; } Entity e = new Entity(lexemes, pos); // querying each of the lexemes should give the correct answer set Set<Entity> possibleEntities = getEntity(lexemes.keySet().iterator().next(), pos); for (Entity possibleEntity : possibleEntities) { // return the entity if there is a real entity that matches the possible entity if (e.compareTo(possibleEntity) == 0) { return e; } } return null; }
public Set<Entity> getEntity(String lexeme, PoS pos) { Set<Entity> resultEntities = new HashSet<Entity>(); List<WordEntry> words = new ArrayList<WordEntry>(); for (PartOfSpeech wktPos : WiktionaryUtils.mapPos(pos)) { words.addAll(wkt.getWordEntries(lexeme, wktPos)); } for (WordEntry word : words) { resultEntities.add( new Entity(lexeme, WiktionaryUtils.mapPos(word.getPartOfSpeech()))); } return resultEntities; }
public Set<Entity> getEntity(String lexeme) { Set<Entity> resultEntities = new HashSet<Entity>(); List<WordEntry> words = wkt.getWordEntries(lexeme); for (WordEntry word : words) { resultEntities.add( new Entity(lexeme, WiktionaryUtils.mapPos(word.getPartOfSpeech()))); } return resultEntities; }
@Override public Entity next() { Category cat = wikiCatIterator.next(); String title = ""; try { title = cat.getTitle().getWikiStyleTitle(); } catch (WikiTitleParsingException e) { e.printStackTrace(); System.exit(1); } return new Entity(title); } }
@Override public Entity next() { WordEntry nextWord = keyIter.next(); return new Entity(nextWord.getWord(), WiktionaryUtils.mapPos(nextWord.getPartOfSpeech())); } }
/** * @param synset A WordNet synset. * @return Creates an Entity from a synset. */ public static Entity synsetToEntity(Synset synset) { if (synset == null) { return null; } return new Entity(getSynsetLexemes(synset), mapPos(synset.getPOS())); }
/** * @param synset A WordNet synset. * @return Creates an Entity from a synset. */ public static Entity synsetToEntity(Synset synset) { if (synset == null) { return null; } return new Entity(getSynsetLexemes(synset), WordNetUtils.mapPos(synset.getPOS())); }
public Set<Entity> getParents(Entity entity) throws LexicalSemanticResourceException { Set<Entity> parents = new HashSet<Entity>(); Category cat; String lexeme = WikipediaCategoryUtils.getCaseSensitiveLexeme(entity.getFirstLexeme(), isCaseSensitive); if (lexeme == null) { return parents; } try { cat = wiki.getCategory(lexeme); if (cat == null) { return parents; } Set<Category> parentCategories = cat.getParents(); for (Category parentCategory : parentCategories) { parents.add(new Entity(parentCategory.getTitle().getWikiStyleTitle())); } } catch (WikiApiException e) { throw new LexicalSemanticResourceException(e); } return parents; }
public Set<Entity> getChildren(Entity entity) throws LexicalSemanticResourceException { Set<Entity> children = new HashSet<Entity>(); Category cat = null; String lexeme = WikipediaCategoryUtils.getCaseSensitiveLexeme(entity.getFirstLexeme(), isCaseSensitive); if (lexeme == null) { return children; } try { cat = wiki.getCategory(lexeme); if (cat == null) { return children; } Set<Category> childCategories = cat.getChildren(); for (Category childCategory : childCategories) { children.add(new Entity(childCategory.getTitle().getWikiStyleTitle())); } } catch (WikiApiException e) { throw new LexicalSemanticResourceException(e); } return children; }
return new Entity(lexemes);