123456789101112131415161718192021 |
- def leaf_strategy(doc):
- """
- Should return an arrays of variable names based on leaf strategy
- :param doc: spacy document
- :return Array of strings
- """
- suggestions = dfs(doc[0])
- return suggestions
- def dfs(graph, result=[], output=[]):
- flag = False
- for u in graph.children:
- flag = True
- dfs(u, [*result, graph], output)
- if flag is False:
- output.append([*result, graph])
- return output
|