Search in sources :

Example 6 with GlossaryEntry

use of org.omegat.gui.glossary.GlossaryEntry in project omegat by omegat-org.

the class TaaSGlossary method search.

@Override
public List<GlossaryEntry> search(Language sLang, Language tLang, String srcText) throws Exception {
    if (!Preferences.isPreferenceDefault(Preferences.TAAS_LOOKUP, false) || !TaaSPlugin.getClient().isAllowed()) {
        return Collections.emptyList();
    }
    TaasExtractionResult res = TaaSPlugin.getClient().termExtraction(sLang, tLang, srcText, Preferences.getPreference(Preferences.TAAS_DOMAIN));
    String data = TaaSPlugin.filterTaasResult(res.getTerms());
    List<GlossaryEntry> entries = GlossaryReaderTBX.read(data, false, OStrings.getString("TAAS_GLOSSARY_NAME"));
    Log.logDebug(LOGGER, "TaaS returns {0} glossary entries", entries.size());
    return entries;
}
Also used : GlossaryEntry(org.omegat.gui.glossary.GlossaryEntry) TaasExtractionResult(gen.taas.TaasExtractionResult)

Aggregations

GlossaryEntry (org.omegat.gui.glossary.GlossaryEntry)6 ArrayList (java.util.ArrayList)2 TaasExtractionResult (gen.taas.TaasExtractionResult)1 File (java.io.File)1 IOException (java.io.IOException)1 RandomAccessFile (java.io.RandomAccessFile)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Test (org.junit.Test)1 KnownException (org.omegat.core.KnownException)1 EntryKey (org.omegat.core.data.EntryKey)1 ExternalTMX (org.omegat.core.data.ExternalTMX)1 IProject (org.omegat.core.data.IProject)1 PrepareTMXEntry (org.omegat.core.data.PrepareTMXEntry)1 ProjectTMX (org.omegat.core.data.ProjectTMX)1 SourceTextEntry (org.omegat.core.data.SourceTextEntry)1 TMXEntry (org.omegat.core.data.TMXEntry)1 RebaseAndCommit (org.omegat.core.team2.RebaseAndCommit)1