@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LocalId localId = (LocalId) o; return id == localId.id && language.equals(localId.language); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LocalString that = (LocalString) o; return language.equals(that.language) && string.equals(that.string); }
public String getLangCodeString() { List<String> output = Lists.newArrayList(); for (Language lang : langs) { if (lang.equals(defaultLanguage)) { output.add(lang.getLangCode().toUpperCase()); } else { output.add(lang.getLangCode()); } } Collections.sort(output); return StringUtils.join(output, ","); }
if (language.equals(Language.getByLangCode("simple"))) language = Language.getByLangCode("en"); // simple english if (tokenizerClasses.containsKey(language)) { // is just english return (LanguageTokenizer) tokenizerClasses.get(language)
if (language.equals(Language.getByLangCode("simple"))) language = Language.getByLangCode("en"); // simple english if (tokenizerClasses.containsKey(language)) { // is just english return (LanguageTokenizer) tokenizerClasses.get(language)
cosim = new double[0][0]; } else { if (!pages.get(0).getLanguage().equals(language)) { throw new DaoException("Expected language " + language + ", found " + pages.get(0).getLanguage());
if (!s.getLanguage().equals(language)) { throw new IllegalArgumentException("Disambiguator only supports language " + language);
@Override public synchronized void trainSimilarity(Dataset dataset) throws DaoException { if (!dataset.getLanguage().equals(getLanguage())) { throw new IllegalArgumentException("SR metric has language " + getLanguage() + " but dataset has language " + dataset.getLanguage()); } normalizers.trainSimilarity(this, dataset); }
@Override public synchronized void trainMostSimilar(Dataset dataset, int numResults, TIntSet validIds){ if (!dataset.getLanguage().equals(getLanguage())) { throw new IllegalArgumentException("SR metric has language " + getLanguage() + " but dataset has language " + dataset.getLanguage()); } normalizers.trainMostSimilar(this, disambiguator, dataset, validIds, numResults); try { if (buildMostSimilarCache) { writeMostSimilarCache(numResults, mostSimilarCacheRowIds, validIds); } } catch (Exception e) { LOG.error("writing most similar cache failed:", e); } }
public boolean equals(Object o){ if (o instanceof LocalPage){ LocalPage input = (LocalPage)o; return (input.getLanguage().equals(this.getLanguage()) && input.getLocalId() == this.getLocalId() ); } else { return false; } }
/** * Indexes a specific RawPage * * @param page the page to index */ public void indexPage(RawPage page) throws DaoException { if (closed) { throw new IllegalStateException("Indexer has already been closed!"); } if (!language.equals(page.getLanguage())) { throw new IllegalStateException("Language mismatch!"); } try { Document document = new Document(); Field localIdField = new IntField(LuceneOptions.LOCAL_ID_FIELD_NAME, page.getLocalId(), Field.Store.YES); Field langIdField = new IntField(LuceneOptions.LANG_ID_FIELD_NAME, page.getLanguage().getId(), Field.Store.YES); Field canonicalTitleField = builder.buildTextField(page, new TextFieldElements().addTitle()); document.add(localIdField); document.add(langIdField); document.add(canonicalTitleField); if (!page.isRedirect()) { for (LuceneOptions option : options) { document.add(builder.buildTextField(page, option.elements)); } } writer.addDocument(document); } catch (IOException e) { throw new RuntimeException(e); } }
throw new IllegalArgumentException("expected phrase " + phrase + ", received " + ks.phrase1); if (!ks.language.equals(language)) { throw new IllegalArgumentException("expected phrase " + language + ", received " + ks.language);
public LocalCategoryMember(LocalPage localCategory, LocalPage localArticle) throws WikiBrainException { if (!localArticle.getLanguage().equals(localCategory.getLanguage())) { throw new WikiBrainException("Language Mismatch"); } this.categoryId = localCategory.getLocalId(); this.articleId = localArticle.getLocalId(); this.language = localCategory.getLanguage(); }
if (datasets.size() > 0 && !lang.equals(datasets.get(0).getLanguage())) { System.err.println("Language mismatch in datasets " + name + " and " + datasets.get(0).getName()); System.exit(1);
/** * * @param metric * @param dataset */ public void trainSimilarity(final SRMetric metric, Dataset dataset) { if (similarityNormalizer instanceof IdentityNormalizer) { return; } if (!dataset.getLanguage().equals(metric.getLanguage())) { throw new IllegalArgumentException("SR metric has language " + metric.getLanguage() + " but dataset has language " + dataset.getLanguage()); } final Normalizer trainee = similarityNormalizer; similarityNormalizer = new IdentityNormalizer(); try { trainee.reset(); ParallelForEach.loop(dataset.getData(), new Procedure<KnownSim>() { public void call(KnownSim ks) throws IOException, DaoException { ks.maybeSwap(); SRResult sim = metric.similarity(ks.phrase1, ks.phrase2, false); trainee.observe(sim == null ? Double.NaN : sim.getScore(), ks.similarity); } }, 100); trainee.observationsFinished(); LOG.info("trained similarity normalizer: " + trainee.dump()); } finally { similarityNormalizer = trainee; } }
return; if (!dataset.getLanguage().equals(metric.getLanguage())) { throw new IllegalArgumentException("SR metric has language " + metric.getLanguage() + " but dataset has language " + dataset.getLanguage());