Class IntentFinderNew

java.lang.Object
com.ubs.backend.services.IntentFinderNew

@Path("find2") public class IntentFinderNew extends Object
Since:
10.08.2021
Author:
Tim Irmler
  • Field Details

    • levenshteinCertain

      private static final float levenshteinCertain
      if the levenshtein distance is equals to this or higher, we are certain that the user meant this word!
      See Also:
      Constant Field Values
    • levenshteinMatch

      private static final float levenshteinMatch
      if the levenshtein distance is equals or higher to this, we are not certain, but it could be that the user meant this word so the word is classified as match anything below this number is ignored
      See Also:
      Constant Field Values
  • Constructor Details

    • IntentFinderNew

      public IntentFinderNew()
  • Method Details

    • findAnswer

      @GET @Produces("application/json") @Path("/answer2") public javax.ws.rs.core.Response findAnswer(@QueryParam("q") String input)
      WebService for getting an Answer to an Input question
      Parameters:
      input - the question from the Frontend
      Returns:
      HTTP Response which contains the Answer which will be displayed on the Frontend. (Can Contain Files)
    • search

      public String search(String input, boolean affectStatistics)
      Takes a String as an Input and compares it with the Tags from the Database Matches Tags to Words in the String
      Parameters:
      input - the input Question
      affectStatistics - if the statistics in the Database will be updated
      Returns:
      the Best Answer as a JSON String
    • isBlacklisted

      private boolean isBlacklisted(String word, BlacklistEntryDAO blacklistEntryDAO, javax.persistence.EntityManager em)
      Method to check if a word is blacklisted. Goes through array and checks if it is contained.
      Parameters:
      word - the word we are looking for
      blacklistEntryDAO - the blacklistentry dao
      em - the entity manager
      Returns:
      if the word is blacklisted
      Since:
      17.07.2021
    • getPossibleAnswerFromArray

      private PossibleAnswer getPossibleAnswerFromArray(ArrayList<PossibleAnswer> possibleAnswers, Answer answer)
      Parameters:
      possibleAnswers -
      answer -
      Returns:
      Since:
      10.08.2021
    • generateJSONResponse

      public String generateJSONResponse(PossibleAnswer answer)
      Parameters:
      answer -
      Returns:
      Since:
      12.08.2021
    • addUnansweredQuestionToDB

      private void addUnansweredQuestionToDB(String question, javax.persistence.EntityManager em)
      Parameters:
      question -
      em -
      Since:
      02.09.2021
    • addUnansweredQuestionToDB

      private void addUnansweredQuestionToDB(StatistikTimes times, String question, javax.persistence.EntityManager em)
      Add questions that cannot be answered to the db
      Parameters:
      question - the question itself
      em - the entity manager
      Since:
      17.07.2021
    • addAnsweredQuestionToDB

      private void addAnsweredQuestionToDB(String question, PossibleAnswer answer, javax.persistence.EntityManager em)
      Add questions that can be answered to the db or update their statistics
      Parameters:
      question - the question itself, how it should be displayed
      answer - the final answer, containing all the results
      em - the entity manager
      Since:
      17.07.2021