germanetpy.longest_shortest_path

Functions

get_greatest_depth(germanet, category)

Iterate trough the synsets of a given word category.

get_longest_possible_shortest_distance(...)

set a maxdistcounter = 0 for each synset: get the corresponding longest shortest distance. if this plus the overall longest shortest distance is smaller than maxdistance: continue with the next synset if it is larger: go trough each synset and get the corresponding longest shortest distance. if this plus the longest shortest distance of the synset of interest is smaller than maxdistance: continue else: compute the actual path distance and update the maxdistance if it is larger.

get_overall_longest_shortest_distance(...)

Iterate trough the synsets of a given wordcategory.

print_longest_shortest_distances(germanet, ...)

Computes and prints the longest shortest distances for the given word category.

print_maximum_depths(germanet, word_category)

Computes and prints the maximum depth for the given word_category.

germanetpy.longest_shortest_path.get_overall_longest_shortest_distance(germanet, category) -> (<class 'dict'>, <class 'int'>)[source]

Iterate trough the synsets of a given wordcategory. For each synset, extract all possible hypernyms and compute the shortest possible distance to each hypernym. From these distances, also store the longest possible shortest distance.

Parameters:
Returns:

a dictionary with each synset and its longest shortest distance, the overall longest shortest distance

germanetpy.longest_shortest_path.get_greatest_depth(germanet, category) int[source]

Iterate trough the synsets of a given word category. For each synset check the depth and return the greatest depth that has been seen.

Parameters:
Returns:

the greatest depth for a given word category. The depth of a synset is defined by the shortest path length between the synset and the root node

germanetpy.longest_shortest_path.get_longest_possible_shortest_distance(germanet, wordcategory)[source]

set a maxdistcounter = 0 for each synset: get the corresponding longest shortest distance. if this plus the overall longest shortest distance is smaller than maxdistance:

continue with the next synset

if it is larger:

go trough each synset and get the corresponding longest shortest distance. if this plus the longest shortest distance of the synset of interest is smaller than maxdistance:

continue

else:

compute the actual path distance and update the maxdistance if it is larger

Return type:

(int, int, tuple(Synset, Synset)

Parameters:
  • wordcategory (WordCategory) – the wordcategory for which this maxlen should be computed

  • germanet (Germanet) – the germanet graph

Returns:

the longest possible shortest distance between two synsets of a specified wordcategory, the maximum depth

of any synset (lenght to the root) and a Tuple with two synsets that have the longest shortest distance

germanetpy.longest_shortest_path.print_longest_shortest_distances(germanet, word_category)[source]

Computes and prints the longest shortest distances for the given word category.

germanetpy.longest_shortest_path.print_maximum_depths(germanet, word_category)[source]

Computes and prints the maximum depth for the given word_category.