/** * Returns a new configurable {@code Builder} for the instantiation of a {@code NAFFilter}. * * @return a new {@code Builder} */ public static final Builder builder() { return new Builder(); }
/** * Creates a {@code NAFFilter} based on the flags specified on this builder object. * * @return the constructed {@code NAFFilter} */ public NAFFilter build() { return new NAFFilter(this); }
public static Set<String> getHypernyms(final String synsetID, final boolean recursive) { return getGenericSet(synsetID, recursive, PointerType.HYPERNYM, PointerType.INSTANCE_HYPERNYM); }
@Override public void accept(final KAFDocument document) { filter(document); }
private LexemeData getLexemeData(final Resource subject) { final String id = idFor(subject); LexemeData lexemeData = data.get(id); if (lexemeData == null) { lexemeData = new LexemeData(id); data.put(id, lexemeData); } return lexemeData; }
public static <T extends Lexeme, L extends Lexicon<T>> L readFrom(final Class<L> lexiconClass, final Class<T> lexemeClass, final Reader reader) throws IOException { final List<T> lexemes = Lists.newArrayList(); final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); String line; while ((line = in.readLine()) != null) { T token = Lexeme.parse(lexemeClass, line); if (token == null) { continue; } lexemes.add(token); } return create(lexiconClass, lexemes); }
public static void init() { getDictionary(); }
public static Token parse(final String string) { return parse(string, null); }
public static PosNegPair searchValue(String wnID) { try { init(); } catch (Exception e) { // continue... } if (values == null) { return null; } return values.get(wnID); }
@Override public boolean contains(final Object object) { if (object instanceof Lexeme) { final Lexeme lexeme = (Lexeme) object; return this.idIndex.get(lexeme.getId()) == lexeme; } return false; }
public static String spellOrdinal(final int ordinal) { if (ordinal <= 12) { return ORDINALS[ordinal]; } if (ordinal % 100 >= 20 && ordinal % 10 == 0) { final String string = spellCardinal(ordinal); return string.substring(0, string.length() - 1) + "ieth"; } if (ordinal > 20 && ordinal % 10 != 0) { final String string = spellCardinal(ordinal / 10 * 10); return string + "-" + ORDINALS[ordinal % 10]; } return spellCardinal(ordinal) + "th"; }
@Override protected Map<String, String> getProperties() { return ImmutableMap.of("type", this.type.toString()); }
private static String classKeyFor(final String fnFrame, final String predicateLemma, final POS predicatePos) { return (fnFrame + "#" + predicateLemma + "." + predicatePos.getLetter()) // .toLowerCase().replace(' ', '_'); }
public static Token create(@Nullable final String lemma, @Nullable final String stem, @Nullable final String pos) { return lemma == null && stem == null && pos == null ? WILDCARD // : new Token(lemma, stem, pos); }
Matrix(final File file) throws IOException { this.vnFrames = HashMultimap.create(); this.fnFrames = HashMultimap.create(); this.eventTypes = HashMultimap.create(); this.vnRoles = HashMultimap.create(); this.fnRoles = HashMultimap.create(); parseMatrix(file); }
public void writeTo(final String location) throws IOException { try (Writer writer = IO.utf8Writer(IO.buffer(IO.write(location)))) { writeTo(writer); } }
public static Set<String> getHyponims(final String synsetID, final boolean recursive) { return getGenericSet(synsetID, recursive, PointerType.HYPONYM, PointerType.INSTANCES_HYPONYM); }
public static Set<String> getHypernyms(final String synsetID) { return getGenericSet(synsetID, PointerType.HYPERNYM); }
public static Set<String> getHyponyms(final String synsetID) { return getGenericSet(synsetID, PointerType.HYPONYM); }