get_longest_possible_shortest_distance function

List get_longest_possible_shortest_distance(
  1. Germanet germanet,
  2. WordCategory category
)

Implementation

List get_longest_possible_shortest_distance(Germanet germanet, WordCategory category){

  List l0 = _get_overall_longest_shortest_distance(germanet, category);
  Map sorted_dist_dic = l0[0];
  int overall_maxlen = l0[1];

  int longest_possible_shortest_distance = 0;

  List synset_pair_longest_distance = [germanet.root(), germanet.root()];

  print(sorted_dist_dic.length);

  for (Synset synset in sorted_dist_dic.keys) {
    var longest_shortest_dist = sorted_dist_dic[synset];
    if(longest_shortest_dist + overall_maxlen <= longest_possible_shortest_distance){
      continue;
    }
    for (Synset current in sorted_dist_dic.keys) {
      var current_shortest_dist = sorted_dist_dic[current];
      if(current_shortest_dist + longest_shortest_dist <= longest_possible_shortest_distance){
        continue;
      }
      var pathdist = current.shortest_path_distance(synset);
      if(pathdist > longest_possible_shortest_distance){
        longest_possible_shortest_distance = pathdist;
        synset_pair_longest_distance = [synset, current];
      }
    }
  }
  return [longest_possible_shortest_distance, overall_maxlen, synset_pair_longest_distance];
}