Package org.apache.stanbol.enhancer.servicesapi

Examples of org.apache.stanbol.enhancer.servicesapi.EngineException


        } catch (NoConvertorException e) {
          log.error(e.getMessage(), e);
        }
      }
        } catch (IOException e) {
            throw new EngineException("Error while calling the CELI Sentiment Analysis service (configured URL: " +serviceURL+")!",e);
        } catch (SOAPException e) {
            throw new EngineException("Error wile encoding/decoding the request/response to the CELI Sentiment Analysis service!",e);
        }

  }
View Full Code Here


    Language lang = new Language(language); // clerezza language for PlainLiterals
    List<LexicalEntry> terms;
    try {
      terms = this.client.performMorfologicalAnalysis(text, language);
    } catch (IOException e) {
      throw new EngineException("Error while calling the CELI Lemmatizer" + " service (configured URL: " + serviceURL + ")!", e);
    } catch (SOAPException e) {
      throw new EngineException("Error wile encoding/decoding the request/" + "response to the CELI lemmatizer service!", e);
    }
    // get a write lock before writing the enhancements
    ci.getLock().writeLock().lock();
    try {
      LiteralFactory literalFactory = LiteralFactory.getInstance();
View Full Code Here

    Language lang = new Language(language); // clerezza language for PlainLiterals
    String lemmatizedContents;
    try {
      lemmatizedContents = this.client.lemmatizeContents(text, language);
    } catch (IOException e) {
      throw new EngineException("Error while calling the CELI Lemmatizer" + " service (configured URL: " + serviceURL + ")!", e);
    } catch (SOAPException e) {
      throw new EngineException("Error wile encoding/decoding the request/" + "response to the CELI lemmatizer service!", e);
    }
    // get a write lock before writing the enhancements
    ci.getLock().writeLock().lock();
    try {
      UriRef textEnhancement = EnhancementEngineHelper.createTextEnhancement(ci, this);
View Full Code Here

                }
            } catch (IOException e) {
                String message = String.format("IOException while reading from "
                    +"CharSequenceReader of AnalyzedText for ContentItem %s",ci.getUri());
                log.error(message,e);
                throw new EngineException(this, ci, message, e);
            }
        }
        //now the tokens
        TokenStream tokens = new WordTokenFilter(new AnalyzedTextSentenceTokenizer(at));
        try {
          tokens.reset();
            while(tokens.incrementToken()){
                OffsetAttribute offset = tokens.addAttribute(OffsetAttribute.class);
                Token t = at.addToken(offset.startOffset(), offset.endOffset());
                log.trace("detected {}",t);
            }
        } catch (IOException e) {
            String message = String.format("IOException while reading from "
                +"CharSequenceReader of AnalyzedText for ContentItem %s",ci.getUri());
            log.error(message,e);
            throw new EngineException(this, ci, message, e);
        }
    }
View Full Code Here

        isLangaugeConfigured(this, languageConfig, language, true);
        List<LexicalEntry> terms;
        try {
            terms = this.client.performMorfologicalAnalysis(at.getSpan(), language);
        } catch (IOException e) {
            throw new EngineException("Error while calling the CELI Lemmatizer"
                    + " service (configured URL: " + serviceURL + ")!", e);
        } catch (SOAPException e) {
            throw new EngineException("Error wile encoding/decoding the request/" +
                    "response to the CELI lemmatizer service!", e);
        }
        Map<LexicalCategory,Double> tokenLexCats = new EnumMap<LexicalCategory,Double>(LexicalCategory.class);
        for(LexicalEntry term : terms){
            if(term.getTermReadings().isEmpty()){
View Full Code Here

            }
        } catch (IOException e) {
            String message = String.format("IOException while reading from "
                +"CharSequenceReader of AnalyzedText for ContentItem %s",ci.getUri());
            log.error(message,e);
            throw new EngineException(this, ci, message, e);
        }
    }
View Full Code Here

            if (!StringUtils.isBlank(disambiguationContext)) {
                try {
                    results = query(site, savedEntityLabel, contentLangauge, disambiguationContext);
                } catch (SiteException e) {
                    // TODO we could also try to catch those errors ...
                    throw new EngineException("Unable to disambiguate Mention of '" + savedEntity.getName()
                            + "' on Entityhub Site '" + site.getId() + "!", e);
                }
                log.debug(" - {} results returned by query {}", results.size(), results.getQuery());
                // match the results with the suggestions
                disambiguateSuggestions(results, savedEntity);
View Full Code Here

    //      * No try/catch that also includes RuntimeExceptions
    List<Concept> lista;
    try {
      lista = this.client.extractConcepts(text, language);
        } catch (IOException e) { //re-throw exceptions as EngineException
            throw new EngineException("Error while calling the CELI classification"
                +" service (configured URL: " +serviceURL+")!",e);
        } catch (SOAPException e) {
            throw new EngineException("Error wile encoding/decoding the request/"
                +"response to the CELI classification service!",e);
        }
    if(lista.isEmpty()){ //not topics found
        return; //nothing to do
    }
View Full Code Here

        // TODO: we need to do the same for the the default matching language
        TaggingSession session;
        try {
            session = TaggingSession.createSession(indexConfig, language);
        } catch (CorpusException e) {
            throw new EngineException(this, ci, e);
        }
        long taggingStart = System.currentTimeMillis();
        final NavigableMap<int[],Tag> tags = new TreeMap<int[],Tag>(Tag.SPAN_COMPARATOR);
        try {
            //process the language of the document
            Corpus corpus = null;
            if(session.getLanguageCorpus() != null){
                corpus = session.getLanguageCorpus();
                long t = System.currentTimeMillis();
                int d = tag(at, session,corpus,tags);
                log.debug(" - {}: fst: {}ms (callback: {}ms)", new Object[]{
                        corpus.getIndexedField(), System.currentTimeMillis()-t, d
                });
            }
            if(session.getDefaultCorpus() != null){
                if(corpus == null){
                    corpus = session.getDefaultCorpus();
                }
                long t = System.currentTimeMillis();
                int d = tag(at, session, session.getDefaultCorpus(),tags);
                log.debug(" - {}: fst: {}ms (callback: {}ms)",new Object[]{
                        session.getDefaultCorpus().getIndexedField(),
                        System.currentTimeMillis()-t, d});
            }
            long taggingEnd = System.currentTimeMillis();
            if(corpus == null){
                throw new EngineException(this,ci,"No FST corpus found to process contentItem "
                    + "language '"+session.getLanguage()+"'!",null);
            } else {
                if(session.getLanguageCorpus() != null && session.getDefaultCorpus() != null){
                    log.debug(" - sum fst: {} ms", taggingEnd - taggingStart);
                }
            }
            int matches = match(at,tags.values());
            log.debug(" - loaded {} ({} loaded, {} cached, {} appended) Matches in {} ms",
                    new Object[]{matches, session.getSessionDocLoaded(),
                        session.getSessionDocCached(), session.getSessionDocAppended(),
                        System.currentTimeMillis()-taggingEnd});
            if(log.isDebugEnabled() && session.getDocumentCache() != null){
                log.debug("EntityCache Statistics: {}",
                    session.getDocumentCache().printStatistics());
            }
        } catch (IOException e) {
            throw new EngineException(this,ci,e);
        } finally {
            session.close();
        }
        if(log.isTraceEnabled()){
            log.trace("Tagged Entities:");
View Full Code Here

                if(at == null){
                    log.debug(" ... create new AnalysedText instance for Engine {}", engine.getName());
                    at = analysedTextFactory.createAnalysedText(ci, textBlob.getValue());
                }
            } catch (IOException e) {
                throw new EngineException("Unable to create AnalysetText instance for Blob "
                    + textBlob.getKey()+ " of ContentItem "+ci.getUri()+"!",e);
            } finally {
                ci.getLock().writeLock().unlock();
            }
        } else {
View Full Code Here

TOP

Related Classes of org.apache.stanbol.enhancer.servicesapi.EngineException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.