Graph Recurser

Classes:

Graph_Recurser(corpus, subtractions, …)

Turns out its a aa a lll a grappp hhh maaaaeeeennnnnn

Functions:

_unstack_words(words)

take the words of Recurser to those of Graph_Recurser

class recurse_words.recursers.graph.Graph_Recurser(corpus, subtractions: bool = True, replacements: bool = True, *args, **kwargs)

Bases: recurse_words.recursers.recurse_words.Recurser

Turns out its a aa a lll a grappp hhh maaaaeeeennnnnn

This class will eventually replace Recurser as there’s no reason to have both I just didn’t want to screw that one up is all.

Parameters
  • corpus ()

  • subtractions ()

  • replacements ()

  • *args ()

  • **kwargs ()

Methods:

__init__(corpus[, subtractions, replacements])

Parameters
  • corpus ()

recurse_word(word[, min_test_word, …])

Recurse a single word – see recurse_all_words() for args

recurse_all_words([min_include_word, …])

Populate word_trees by searching recursively through words for recurse words

make_graph([root_word, graph_attr, depth, …])

Attributes:

word_edges

word_trees except for just a list of the edges after they have been made unique by calling set()

__init__(corpus, subtractions: bool = True, replacements: bool = True, *args, **kwargs)
Parameters
  • corpus ()

  • subtractions ()

  • replacements ()

  • *args ()

  • **kwargs ()

property word_edges

word_trees except for just a list of the edges after they have been made unique by calling set()

Returns

[(from_word, transformation, to_word),…]

recurse_word(word: str, min_test_word: int = 2, min_clipped_word: int = 3)Dict[str, Tuple[Tuple[str, str, str]]]

Recurse a single word – see recurse_all_words() for args

Note

this could be made about a zillion times faster by vectorizing with pandas…

recurse_all_words(min_include_word: int = 9, min_test_word: int = 2, min_clipped_word: int = 3, max_depth: int = 0, n_procs: int = 12, batch_size: int = 100)

Populate word_trees by searching recursively through words for recurse words

Parameters
  • min_include_word (int) – Minimum length of original words to test

  • min_test_word (int) – Minimum size of subwords to test splicing subwords with

  • min_clipped_word (int) – Minimum size of the resulting spliced/clipped word to be considered for additional recursive subwords

  • max_depth (int) – Maximum recursion depth to allow, if 0, infinite

  • n_procs (int) – Number of processors to spawn in the multiprocessing pool

make_graph(root_word: Optional[str] = None, graph_attr: dict = {}, depth: int = 0, node_attr: dict = {}, edge_attr: dict = {}, translate=True)pygraphviz.agraph.AGraph
recurse_words.recursers.graph._unstack_words(words: Dict[int, list])Tuple[Tuple[str], Dict[str, int]]

take the words of Recurser to those of Graph_Recurser

Parameters

words ()

Returns

replacements for words and _words