Skip to content

Algorithm

akvohrer edited this page Jun 29, 2023 · 6 revisions

Time Trigger Logic implementation

Debugging Insights

Old Logic

private static void checkIsTimeTriggered( TreeGraphNode node, Collection<TypedDependency> dependencies, Action action) { logger.info("Check for time trigger."); List<TypedDependency> _toCheck = SearchUtils.findDependency(ListUtils.getList("tmod"), dependencies); for (TypedDependency td : _toCheck) { if (td.gov().equals(node)) { action.setTriggerType(TriggerType.TRIGGER_TYPE_TIME); } } }

  • Method CheckIsTimeTriggered checks for dependencies

  • Dependencies are set in Method CreateSentence via StanfordParser

  • In StanfordParser (accessed via Microservice) all dependencies are defined

  • For time trigger dependency tmod needs to be found

  • With example sentence "Last night I swam in the pool" tmod is found

  • with example sentence "create a file on tuesday" tmod not found

  • --> tmod checking is not enough to identify time triggers correctly

Helpfull insights

  • time trigger information (e.g. on tuesday) is stored in specifier-variable of the action object
  • Class WordNetFunctionallity has method isTimePeriod
  • ! method isTimePeriod doesn't recognize "am" or "pm" as periods

Idea

  • Not checking dependencies anymore
  • Checking the string in specifier if it is a time trigger
  • Additional check for time information (am / pm)

Updated Logic

private static void checkIsTimeTriggered( TreeGraphNode node, Collection<TypedDependency> dependencies, Action action) { logger.info("Check for time trigger."); Boolean timeRelated = false; String specifier = action.getSpecifiers().toString(); String[] words = specifier.split(" "); String word; for (int i = 0; i < words.length; i++) { word = words[i]; if (WordNetWrapper.isTimePeriod(word)) { timeRelated = true; break; } if ((word.contains("pm")) || (word.contains("am"))){ timeRelated = true; break; } } if (timeRelated) { action.setTriggerType(TriggerType.TRIGGER_TYPE_TIME); } }

Further Ideas

  • Looking for more methods in WordNetWrapper such as IsTimePeriod to check even more eventual time information
  • Combining dependency check tmod with new logic to cover all eventualities

Exporting TimeTrigger information for BPMN 2.0

Debugging Insights

Further Ideas

Clone this wiki locally