diff --git a/Makefile b/Makefile index d4e6be6..f655563 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ ENV=.venv BIN=$(ENV)/bin/ -DIRS=src/ tests/unit/ tests/performance/ scripts/ docs/ +DIRS=src/ tests/ scripts/ docs/ BROWSER=firefox PYTEST=pytest --doctest-modules --doctest-glob="*.rst" --doctest-ignore-import-errors @@ -38,9 +38,9 @@ coverage: $(BIN)coverage erase $(BIN)coverage run --branch --source=src -m $(PYTEST) tests/ $(BIN)coverage run --append --branch --source=src -m $(PYTEST) --debug-mode tests/ - $(BIN)coverage report $(BIN)coverage html $(BROWSER) htmlcov/index.html + $(BIN)coverage json -o - | $(BIN)python tests/make_coverage_badge.py > docs/_images/badge-coverage.svg profile: $(BIN)python -O -m scripts.profile @@ -48,13 +48,10 @@ profile: docs: cd docs; make html -badges: test coverage - $(BIN)python docs/make_badges.py - tox: $(BIN)tox -dist: clean test coverage badges +dist: clean tox coverage docs $(BIN)python -m build $(BIN)twine check dist/* @@ -72,5 +69,6 @@ uninstall: clean: -rm -rf dist build *.egg-info + -rm docs/_images/badge*.svg -rm *~ .*~ pylintgraph.dot -find . -name __pycache__ -type d -exec rm -r "{}" \; diff --git a/README.rst b/README.rst index 2c4d5b2..b191eec 100644 --- a/README.rst +++ b/README.rst @@ -2,17 +2,17 @@ A Generalized Suffix Tree =========================== -.. |py39| image:: docs/_images/tox-py39.svg +.. |py39| image:: docs/_images/badge-py39.svg -.. |py310| image:: docs/_images/tox-py310.svg +.. |py310| image:: docs/_images/badge-py310.svg -.. |py311| image:: docs/_images/tox-py311.svg +.. |py311| image:: docs/_images/badge-py311.svg -.. |py312| image:: docs/_images/tox-py312.svg +.. |py312| image:: docs/_images/badge-py312.svg -.. |pypy39| image:: docs/_images/tox-pypy39.svg +.. |pypy39| image:: docs/_images/badge-pypy39.svg -.. |coverage| image:: docs/_images/coverage.svg +.. |coverage| image:: docs/_images/badge-coverage.svg |py39| |py310| |py311| |py312| |pypy39| |coverage| diff --git a/docs/_build/_images/badge-coverage.svg b/docs/_build/_images/badge-coverage.svg new file mode 100644 index 0000000..97a04fe --- /dev/null +++ b/docs/_build/_images/badge-coverage.svg @@ -0,0 +1 @@ +coverage: 100%coverage100% diff --git a/docs/_images/tox-py310.svg b/docs/_build/_images/badge-py310.svg similarity index 100% rename from docs/_images/tox-py310.svg rename to docs/_build/_images/badge-py310.svg diff --git a/docs/_images/tox-py311.svg b/docs/_build/_images/badge-py311.svg similarity index 100% rename from docs/_images/tox-py311.svg rename to docs/_build/_images/badge-py311.svg diff --git a/docs/_images/tox-py312.svg b/docs/_build/_images/badge-py312.svg similarity index 100% rename from docs/_images/tox-py312.svg rename to docs/_build/_images/badge-py312.svg diff --git a/docs/_images/tox-py39.svg b/docs/_build/_images/badge-py39.svg similarity index 100% rename from docs/_images/tox-py39.svg rename to docs/_build/_images/badge-py39.svg diff --git a/docs/_images/tox-pypy39.svg b/docs/_build/_images/badge-pypy39.svg similarity index 100% rename from docs/_images/tox-pypy39.svg rename to docs/_build/_images/badge-pypy39.svg diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle index de97c09..8bfa705 100644 Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ diff --git a/docs/_build/searchindex.js b/docs/_build/searchindex.js index d54be9e..734bf39 100644 --- a/docs/_build/searchindex.js +++ b/docs/_build/searchindex.js @@ -1 +1 @@ -Search.setIndex({"docnames": ["builder/builder", "builder/mccreight", "builder/naive", "builder/ukkonen", "builders", "examples", "index", "lca", "node", "performance", "references", "tree", "util"], "filenames": ["builder/builder.rst", "builder/mccreight.rst", "builder/naive.rst", "builder/ukkonen.rst", "builders.rst", "examples.rst", "index.rst", "lca.rst", "node.rst", "performance.rst", "references.rst", "tree.rst", "util.rst"], "titles": ["Base Class for Builders", "McCreight Builder", "Naive Builder", "Ukkonen Builder", "Builders", "Examples", "suffix-tree Documentation", "LCA Mixin", "Node", "Performance", "References", "Tree", "Utilities"], "terms": {"bf": 1, "": [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12], "i": [0, 1, 3, 4, 5, 6, 7, 8, 11, 12], "1": [1, 3, 5, 7, 8, 11, 12], "t_": [1, 8], "imath": 1, "2": [1, 2, 3, 5, 8, 10, 11], "suf": 1, "jmath": 1, "head": [1, 3], "tail": 1, "b": [1, 3, 5, 7, 8, 11], "alpha": [1, 8, 11], "beta": [1, 11], "gamma": 1, "delta": 1, "rho": 1, "chi": 1, "x": [1, 3, 5, 7, 8, 11], "The": [0, 1, 3, 4, 6, 8, 11], "origin": 1, "mathemat": 1, "precis": 1, "exposit": 1, "blockquot": 1, "taken": 1, "from": [1, 3, 4, 5, 6, 7, 8, 11, 12], "excel": 1, "paper": [1, 3], "mccreight1976": [1, 3, 6, 10], "comment": 1, "ar": [1, 3, 6, 8, 9, 12], "me": 1, "try": [1, 3], "understand": [1, 3], "translat": 1, "languag": 1, "suit": 1, "mere": [1, 3], "mortal": [1, 3], "first": [1, 3, 7, 8, 12], "defin": [1, 8, 11], "extens": 1, "an": [1, 3, 7, 8, 11], "string": [1, 3, 6, 7, 8, 10, 11], "ani": [1, 3, 6, 7, 8, 11], "which": [1, 3, 4], "prefix": 1, "locu": [1, 3], "node": [1, 2, 3, 6, 7, 11, 12], "end": [1, 3, 8, 12], "path": [1, 3, 5, 6, 7, 8, 11, 12], "name": [1, 3, 8], "mai": [1, 3, 9], "exist": [1, 5], "extend": [1, 11], "shortest": [1, 3], "whose": 1, "thi": [0, 1, 2, 3, 4, 6, 7, 8, 9, 12], "itself": [1, 3, 7], "contract": [1, 3], "longest": [1, 11], "suffix": [1, 2, 3, 5, 7, 8, 9, 10, 11, 12], "begin": 1, "charact": [1, 3, 4, 8, 11], "posit": [1, 7, 8, 11, 12], "also": [1, 3, 8, 11, 12], "some": [1, 3, 7], "j": [1, 3], "equival": 1, "within": 1, "tree": [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 12], "we": [1, 3, 7, 8, 11, 12], "algorithm": [1, 2, 3, 6, 8, 9, 10], "insert": [1, 2, 3, 8], "all": [0, 1, 3, 5, 7, 8, 11], "order": 1, "In": [1, 3, 4, 7, 8], "each": [1, 3, 4, 8, 11, 12], "step": [1, 3, 5], "one": [1, 3, 4, 5, 6, 7, 8, 11], "creat": [1, 3, 8], "leaf": [1, 3, 6, 7, 8, 11], "most": [1, 3, 7], "intern": [0, 1, 2, 3, 6, 7, 8, 11], "For": [1, 7, 8, 11], "link": [1, 3], "next": [1, 3, 8], "To": [1, 3, 6], "search": [1, 3, 6], "root": [0, 1, 2, 3, 7, 8, 11], "until": 1, "get": [1, 3, 6, 7, 8, 11], "mismatch": 1, "If": [1, 3, 8, 12], "happen": 1, "call": [0, 1, 3, 7, 8, 11], "middl": [1, 3], "edg": [1, 3, 7, 8], "split": [1, 3, 8], "new": [1, 3, 8], "Then": 1, "append": [1, 8], "procedur": [1, 3], "slow": [1, 4], "becaus": [1, 8], "have": [1, 3, 4, 6, 8, 11], "start": [1, 3, 7, 8, 11, 12], "over": [1, 3, 4, 7], "again": 1, "show": 1, "u": [1, 3, 7, 10], "how": [1, 3, 12], "warp": 1, "linear": [1, 3, 6, 9], "time": [1, 2, 3, 6, 7, 9], "us": [1, 2, 3, 6, 7, 8, 9, 12], "rescan": [1, 3], "he": 1, "demonstr": 1, "can": [1, 3, 5, 6, 7, 8], "set": [0, 1, 6, 7, 8, 12], "exploit": 1, "lemma": [1, 7], "written": 1, "possibli": 1, "empti": [1, 3], "proof": 1, "By": [1, 8], "induct": 1, "suppos": [1, 11], "mean": 1, "both": [1, 3, 7, 9], "thu": [1, 3], "therefor": [1, 3, 8], "definit": [1, 7, 8, 11], "quad": 1, "squar": 1, "rephras": 1, "wa": [1, 3, 11], "find": [1, 3, 5, 8, 11], "c": [1, 5, 7, 8, 10, 11], "possibl": [1, 3], "onli": [1, 3, 4, 7, 8], "previou": 1, "diverg": 1, "But": 1, "must": [1, 3], "previous": 1, "relationship": 1, "auxiliari": [1, 8], "ad": [1, 3], "our": 1, "structur": 1, "nontermin": 1, "where": [1, 8, 11], "introduc": 1, "point": [1, 3, 8, 11], "note": [1, 8, 12], "never": 1, "subtre": [1, 7, 8], "These": 1, "enabl": 1, "do": [1, 4], "short": 1, "cut": 1, "ha": [1, 3, 4, 7, 8], "visit": [1, 8, 11], "follow": [1, 2, 3], "semiform": 1, "present": [1, 3, 4], "prove": 1, "p1": 1, "could": 1, "fail": 1, "valid": 1, "p2": 1, "properti": [1, 8], "clearli": 1, "obtain": 1, "now": 1, "doe": [1, 3, 6], "It": [1, 3, 6, 8], "descript": [1, 2], "substep": [1, 3], "A": [1, 2, 3, 5, 7, 8, 10, 11, 12], "let": [1, 3, 7], "write": [1, 12], "down": 1, "concaten": [1, 11], "three": [1, 3, 6, 7], "same": [1, 3], "wai": 1, "more": [1, 3, 12], "import": [1, 5, 7, 11], "when": [1, 8, 12], "part": [1, 12], "circuit": 1, "fast": [1, 3, 6], "forward": [1, 3], "third": 1, "scan": [1, 3], "And": 1, "last": [1, 3, 8], "go": [1, 3, 8], "ancestor": [1, 3, 6, 7], "self": [1, 7, 8, 12], "That": [1, 8, 11], "would": [1, 3, 11], "goto": 1, "don": [1, 8, 12], "t": [1, 3, 5, 7, 8, 12], "special": 1, "case": [1, 4], "identifi": [1, 3, 8], "repres": [1, 3, 8], "otherwis": 1, "guarante": 1, "choos": [1, 4], "appropri": 1, "two": [1, 3, 7, 8, 11], "goe": [1, 8], "nonempti": 1, "sinc": [1, 8, 9], "been": [1, 6], "construct": [1, 8, 10, 11, 12], "befor": [1, 8, 11], "its": [1, 8, 11], "second": [1, 3], "save": [1, 7, 8], "trick": 1, "devis": 1, "what": [1, 3], "alreadi": [1, 3], "know": [1, 3], "match": [1, 8], "so": [1, 3, 7, 8], "need": [1, 3, 8, 12], "examin": 1, "decid": 1, "overshoot": 1, "length": [1, 5, 6, 8, 9, 11, 12], "usual": [1, 8], "found": [1, 11], "d": [1, 5, 11], "kei": [1, 11], "idea": [1, 6], "m": [1, 11], "sequenc": [0, 1, 2, 3, 5, 6, 8, 9, 10, 11, 12], "arc": [1, 3], "downward": 1, "spell": [1, 11], "out": [1, 3, 11, 12], "child": [1, 3, 8], "lead": [1, 3, 7, 8], "shall": 1, "f": [1, 3, 5, 8, 11], "compar": 1, "longer": [1, 8], "recurs": [1, 8], "begun": 1, "shorter": 1, "complet": 1, "accomplish": 1, "number": [1, 7, 8, 11], "encount": 1, "back": 1, "naiv": [1, 4, 6, 11], "unmatch": 1, "rest": [1, 3], "increment": 1, "current": [0, 1, 8, 11], "undefin": 1, "hypothesi": 1, "establish": 1, "truth": 1, "deeper": [1, 8], "major": 1, "differ": [1, 3, 6, 8, 11], "between": [1, 11], "known": 1, "beforehand": [1, 3], "while": [1, 3], "travel": 1, "respons": 1, "left": [1, 3, 8, 11], "right": [1, 3, 7, 8, 11], "fall": 1, "constraint": 1, "s1": 1, "trek": 1, "final": [1, 3], "label": [1, 3, 8, 11, 12], "termin": 1, "finish": 1, "http": [1, 3, 6, 7, 10], "www": [1, 7, 10], "helsinki": [1, 10], "fi": [1, 10], "tpkarkka": 1, "opetu": 1, "10": [1, 5, 6, 10], "spa": 1, "lectur": 1, "pdf": [1, 10], "veri": [3, 6], "similar": 3, "mccreight": [3, 4, 6, 8, 9, 10], "ukkonen1995": [3, 6, 8, 10], "english": 3, "phase": [3, 8, 11, 12], "round": [0, 3, 4], "implicit": [3, 8], "state": [3, 8], "substr": [3, 5, 8, 11], "explicit": 3, "branch": 3, "transit": [3, 8], "function": [0, 3, 8, 11, 12], "pointer": [3, 8], "activ": 3, "canon": 3, "represent": [3, 7], "parent": [3, 8], "t_i": 3, "whole": 3, "dot": [3, 8, 12], "t_n": 3, "build": [0, 1, 2, 3, 6, 9, 11], "python": [3, 6, 8], "gener": [1, 3, 6, 8, 11], "readi": [3, 4], "constant": [3, 6, 7], "after": [3, 4, 8, 11], "easier": 3, "per": [3, 7, 8], "clear": 3, "mani": [3, 7], "fig": 3, "3": [3, 5, 6, 7, 11], "leav": [3, 8], "preced": 3, "noth": 3, "annot": 3, "subsequ": 3, "indic": [0, 3, 8, 12], "k": [3, 5, 7, 8, 11], "p": 3, "suffici": 3, "uniqu": [3, 7], "refer": [3, 6, 7], "instead": [3, 8], "paramet": [0, 1, 2, 3, 8, 11], "pair": [3, 11], "prefer": [3, 12], "them": [3, 8, 12], "problem": [3, 7], "0": [3, 7, 12], "beyond": 3, "conclus": 3, "becom": 3, "treat": 3, "trie": 3, "automaton": 3, "describ": 3, "everi": [0, 3], "convers": 3, "true": [3, 5, 9, 11, 12], "abc": [3, 5, 11], "overlin": 3, "compress": 3, "without": 3, "those": [3, 9], "than": [3, 8, 12], "As": 3, "consequ": 3, "had": 3, "remov": 3, "still": 3, "retain": 3, "alwai": [3, 4], "ones": 3, "made": 3, "explict": 3, "tripl": 3, "There": 3, "rememb": 3, "nearest": 3, "abov": [3, 8], "g": [3, 8], "r": [3, 8], "bar": 3, "y": [3, 7], "anoth": 3, "encod": 3, "minu": 3, "symbol": [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12], "you": [0, 3, 6, 7], "cacao": 3, "acao": 3, "cao": 3, "ao": 3, "aux": 3, "open": [3, 8], "grow": [3, 8], "automat": 3, "whenev": 3, "boundari": 3, "chain": 3, "deepest": [3, 7, 8], "ist": 3, "add": [0, 1, 2, 3, 5, 8, 11], "reach": 3, "plain": 3, "stackoverflow": 3, "com": 3, "question": 3, "9452701": 3, "should": [0, 4, 8, 12], "tl": 4, "dr": 4, "fastest": 4, "implement": [1, 2, 3, 4, 6, 7, 8, 9, 12], "ukkonen": [4, 6, 8, 9, 10, 11, 12], "real": 4, "advantag": 4, "except": 4, "your": 4, "come": 4, "sourc": 4, "rel": 4, "cpu": 4, "arriv": 4, "educ": 4, "purpos": 4, "base": [4, 6, 8], "class": [1, 2, 3, 4, 6, 7, 8, 11, 12], "instal": [5, 6], "pip": 5, "librari": [5, 9], "suffix_tre": [5, 7, 11], "initi": [5, 11, 12], "xabxac": [5, 7, 11], "awyawxawxz": [5, 7, 11], "Or": 5, "dictionari": [5, 8, 9, 11], "queri": [5, 6, 7], "abx": [5, 11], "awx": [5, 11], "fals": [5, 11, 12], "find_id": [5, 11], "enumer": 5, "hit": 5, "id_": [0, 1, 2, 3, 5, 11, 12], "find_al": [5, 11], "xa": 5, "print": [5, 11, 12], "str": [5, 7, 8, 11, 12], "w": [5, 7, 11], "z": [5, 11], "contain": [5, 7, 8, 11], "kind": 5, "hashabl": [0, 1, 2, 3, 5, 6, 8, 11, 12], "object": [0, 1, 2, 3, 5, 8, 11, 12], "hello": 5, "world": 5, "frozenset": 5, "common": [5, 6, 7, 8, 11], "sandollar": [5, 11], "sandlot": [5, 11], "handler": [5, 11], "grand": [5, 11], "e": [5, 7, 11], "pantri": [5, 11], "common_substr": [5, 8, 11], "4": [2, 5, 7, 11], "n": [2, 5, 7, 8, 11], "5": [2, 5, 7, 8, 11], "maxim": [5, 8, 11], "repeat": [5, 8, 11], "sort": [5, 11, 12], "maximal_repeat": [5, 8, 11], "lowest": [6, 7], "retriev": [6, 7], "work": 6, "just": [6, 8], "item": [6, 8], "pure": 6, "proport": 6, "input": [3, 6, 9], "builder": [6, 11], "mathcal": [2, 6, 7, 8, 9], "o": [2, 6, 9], "lvert": [6, 9], "rvert": [6, 9], "non": 6, "Being": 6, "nor": 6, "memori": 6, "effici": 6, "take": 6, "rough": 6, "perform": 6, "under": 6, "best": 6, "turn": 6, "optim": 6, "pypi": 6, "org": [6, 7, 10], "project": 6, "exampl": [6, 7], "lca": [6, 8], "mixin": 6, "util": 6, "7": [6, 7, 8, 11], "9": [6, 7], "index": [0, 6], "modul": [1, 3, 6], "page": [2, 6, 7, 8, 11], "being": 9, "strictli": 9, "especi": 9, "larg": 9, "alphabet": 9, "store": 9, "gusfield1997": [2, 7, 8, 10, 11], "gusfield": 10, "dan": 10, "1997": 10, "cambridg": 10, "univers": 10, "press": 10, "edward": 10, "space": 10, "econom": 10, "journal": 10, "associ": 10, "comput": [7, 10, 11], "machineri": 10, "vol": 10, "23": 10, "No": 10, "april": 10, "1976": 10, "dl": 10, "acm": 10, "doi": 10, "1145": 10, "321941": 10, "321946": 10, "esko": 10, "On": 10, "line": 10, "1995": 10, "algorithmica": 10, "14": 10, "249": 10, "60": 10, "suffixt1withfig": 10, "warren2013": [7, 10], "warren": 10, "h": [6, 7, 10], "hacker": 10, "delight": 10, "2nd": 10, "edit": 10, "2013": 10, "pearson": 10, "westford": 10, "ma": 10, "__init__": [0, 3, 7, 8, 11, 12], "iter": [0, 1, 2, 3, 8], "none": [0, 1, 2, 3, 8, 11, 12], "set_progress_funct": 0, "tick": 0, "int": [0, 3, 8, 11, 12], "callback": 0, "callabl": [0, 8, 11], "progress": [0, 11], "chang": [0, 3], "adapt": [1, 3], "id": [1, 2, 3, 7, 8, 11], "close": 2, "93": 2, "tupl": [3, 8, 11], "t_k": 3, "return": [3, 7, 8, 11, 12], "test_and_split": 3, "bool": [3, 8, 11, 12], "test": 3, "endpoint": 3, "eventu": 3, "whether": 3, "strie": 3, "given": [3, 7, 8, 11], "result": 3, "output": [3, 8], "closest": 3, "t_p": 3, "henc": 3, "geq": 3, "updat": 3, "list": [3, 8, 11], "transform": 3, "stree": [3, 8], "group": 3, "mention": 3, "provid": 3, "s_": 3, "actual": [3, 8], "remain": 3, "prime": 3, "itersymbol": 3, "ukkonenleaf": [6, 8], "uint": [6, 7], "nlz": [6, 7], "msb": [6, 7], "debug": [6, 7, 8, 12], "debug_dot": [6, 12], "debug_label": [6, 12], "uniqueendchar": [6, 12], "min_debug_depth": [6, 12], "is_debug": [6, 12], "ukko_str": [6, 12], "With": 7, "abil": 7, "solv": 7, "addit": 7, "196": 7, "v": [7, 8], "proper": 7, "chapter": 7, "8": 7, "181ff": 7, "convert": 7, "unsign": 7, "32": 7, "bit": 7, "zero": 7, "word": 7, "0x1": 7, "31": 7, "0xff": 7, "24": 7, "0xffffffff": 7, "see": [7, 8, 11], "hackersdelight": 7, "hdcodetxt": 7, "txt": 7, "99ff": 7, "dignificat": 7, "signific": 7, "count": 7, "0xf": 7, "valu": [7, 8], "denot": 7, "least": [7, 8, 11], "binari": 7, "184ff": 7, "equal": [7, 11], "height": 7, "1000": 7, "four": 7, "allow": [7, 12], "retirev": 7, "inlin": [7, 8], "subclass": [7, 8], "lca_id": 7, "depth": [7, 8], "travers": [7, 8], "figur": 7, "182": 7, "maximum": 7, "includ": [7, 12], "run": 7, "6": [7, 8, 11], "187": 7, "a_v": 7, "map": 7, "188f": 7, "181": 7, "compute_a": 7, "compute_i_and_l": 7, "l": [7, 8, 11], "prepare_lca": 7, "counter": 7, "prepar": 7, "__str__": [7, 8, 12], "_d": 7, "nodemap": 7, "preprocess": 7, "abstract": 8, "report": 8, "graph": 8, "representaion": 8, "__getitem__": [8, 12], "symol": [8, 12], "slice": [8, 12], "neg": [8, 12], "compute_c": 8, "calcul": 8, "children": [8, 11], "compute_left_divers": 8, "divers": 8, "pre_ord": [8, 11], "walk": [8, 11], "visitor": [8, 11], "post_ord": [8, 11], "add_posit": 8, "get_posit": 8, "_v": 8, "dict": [8, 11], "to_dot": 8, "graphviz": 8, "format": 8, "fix": 8, "suffix_link": 8, "speed": 8, "up": 8, "corollari": 8, "_i": 8, "98": 8, "is_left_divers": 8, "cannot": 8, "12": [8, 11], "144ff": 8, "oper": 8, "distinct": [8, 11], "appear": 8, "127ff": [8, 11], "find_path": [8, 11], "absolut": 8, "split_edg": 8, "new_len": 8, "new_nod": 8, "str_id": 8, "exactli": [8, 11], "len": 8, "less": [8, 12], "concat": 8, "s_1": 8, "s_n": 8, "mutabl": 8, "implicitli": 8, "assum": 8, "Such": 8, "form": 8, "necessari": 8, "infti": 8, "pop": 8, "off": 8, "90f": 8, "type": 11, "featur": 11, "edgl": 11, "interrog": 11, "awyawxacxz": 11, "xac": 11, "option": 11, "default": 11, "regular": 11, "interv": 11, "dure": 11, "probabl": 11, "serv": 11, "occur": 11, "ab": 11, "tabl": 11, "want": 11, "entri": 11, "give": 11, "lk": 11, "ident": 11, "immedi": 11, "either": 11, "direct": 11, "destroi": 11, "143ff": 11, "lot": 12, "inform": 12, "file": 12, "potenti": 12, "confus": 12, "singleton": 12, "signal": 12, "deep": 12, "were": 12, "stack": 12, "emit": 12, "messag": 12, "interest": 12, "msg": 12, "arg": 12, "kwarg": 12, "stderr": 12, "notat": 12, "__lt__": 12, "other": 12, "conveni": 12, "sortabl": 12, "Not": 12, "data": 11}, "objects": {"suffix_tree": [[0, 0, 0, "-", "builder"], [7, 0, 0, "-", "lca_mixin"], [1, 0, 0, "-", "mccreight"], [2, 0, 0, "-", "naive"], [8, 0, 0, "-", "node"], [11, 0, 0, "-", "tree"], [3, 0, 0, "-", "ukkonen"], [12, 0, 0, "-", "util"]], "suffix_tree.builder": [[0, 1, 1, "", "Builder"]], "suffix_tree.builder.Builder": [[0, 2, 1, "", "__init__"], [0, 2, 1, "", "build"], [0, 2, 1, "", "set_progress_function"]], "suffix_tree.lca_mixin": [[7, 1, 1, "", "Internal"], [7, 1, 1, "", "Leaf"], [7, 1, 1, "", "Node"], [7, 1, 1, "", "Tree"], [7, 4, 1, "", "h"], [7, 4, 1, "", "msb"], [7, 4, 1, "", "nlz"], [7, 4, 1, "", "uint"]], "suffix_tree.lca_mixin.Internal": [[7, 3, 1, "", "A"], [7, 3, 1, "", "I"], [7, 2, 1, "", "__str__"], [7, 2, 1, "", "compute_A"], [7, 2, 1, "", "compute_I_and_L"], [7, 3, 1, "", "lca_id"], [7, 2, 1, "", "prepare_lca"]], "suffix_tree.lca_mixin.Leaf": [[7, 3, 1, "", "A"], [7, 3, 1, "", "I"], [7, 2, 1, "", "__str__"], [7, 2, 1, "", "compute_A"], [7, 2, 1, "", "compute_I_and_L"], [7, 3, 1, "", "lca_id"], [7, 2, 1, "", "prepare_lca"]], "suffix_tree.lca_mixin.Node": [[7, 3, 1, "", "A"], [7, 3, 1, "", "I"], [7, 2, 1, "", "__init__"], [7, 2, 1, "", "compute_A"], [7, 2, 1, "", "compute_I_and_L"], [7, 3, 1, "", "lca_id"], [7, 2, 1, "", "prepare_lca"]], "suffix_tree.lca_mixin.Tree": [[7, 2, 1, "", "__init__"], [7, 2, 1, "", "lca"], [7, 3, 1, "", "nodemap"], [7, 2, 1, "", "prepare_lca"]], "suffix_tree.mccreight": [[1, 1, 1, "", "Builder"]], "suffix_tree.mccreight.Builder": [[1, 2, 1, "", "build"]], "suffix_tree.naive": [[2, 1, 1, "", "Builder"]], "suffix_tree.naive.Builder": [[2, 2, 1, "", "build"]], "suffix_tree.node": [[8, 1, 1, "", "Internal"], [8, 1, 1, "", "Leaf"], [8, 1, 1, "", "Node"], [8, 1, 1, "", "UkkonenLeaf"]], "suffix_tree.node.Internal": [[8, 3, 1, "", "C"], [8, 2, 1, "", "__init__"], [8, 2, 1, "", "__str__"], [8, 2, 1, "", "add_position"], [8, 3, 1, "", "children"], [8, 2, 1, "", "common_substrings"], [8, 2, 1, "", "compute_C"], [8, 2, 1, "", "compute_left_diverse"], [8, 2, 1, "", "find_path"], [8, 3, 1, "", "is_left_diverse"], [8, 2, 1, "", "maximal_repeats"], [8, 2, 1, "", "post_order"], [8, 2, 1, "", "pre_order"], [8, 2, 1, "", "split_edge"], [8, 3, 1, "", "suffix_link"]], "suffix_tree.node.Leaf": [[8, 2, 1, "", "__init__"], [8, 2, 1, "", "__str__"], [8, 2, 1, "", "add_position"], [8, 2, 1, "", "compute_C"], [8, 2, 1, "", "compute_left_diverse"], [8, 2, 1, "", "maximal_repeats"], [8, 2, 1, "", "post_order"], [8, 2, 1, "", "pre_order"], [8, 3, 1, "", "str_id"]], "suffix_tree.node.Node": [[8, 3, 1, "", "S"], [8, 2, 1, "", "__getitem__"], [8, 2, 1, "", "__init__"], [8, 2, 1, "", "__str__"], [8, 2, 1, "", "add_position"], [8, 2, 1, "", "common_substrings"], [8, 2, 1, "", "compute_C"], [8, 2, 1, "", "compute_left_diverse"], [8, 3, 1, "", "end"], [8, 2, 1, "", "get_positions"], [8, 2, 1, "", "maximal_repeats"], [8, 3, 1, "", "name"], [8, 3, 1, "", "parent"], [8, 2, 1, "", "post_order"], [8, 2, 1, "", "pre_order"], [8, 3, 1, "", "start"], [8, 2, 1, "", "to_dot"]], "suffix_tree.node.UkkonenLeaf": [[8, 2, 1, "", "__init__"], [8, 5, 1, "", "depth"], [8, 5, 1, "", "end"], [8, 3, 1, "", "str_id"]], "suffix_tree.tree": [[11, 1, 1, "", "Tree"]], "suffix_tree.tree.Tree": [[11, 2, 1, "", "__init__"], [11, 2, 1, "", "add"], [11, 2, 1, "", "common_substrings"], [11, 2, 1, "", "find"], [11, 2, 1, "", "find_all"], [11, 2, 1, "", "find_id"], [11, 2, 1, "", "find_path"], [11, 2, 1, "", "maximal_repeats"], [11, 2, 1, "", "post_order"], [11, 2, 1, "", "pre_order"]], "suffix_tree.ukkonen": [[3, 1, 1, "", "Builder"]], "suffix_tree.ukkonen.Builder": [[3, 2, 1, "", "__init__"], [3, 2, 1, "", "build"], [3, 2, 1, "", "canonize"], [3, 2, 1, "", "test_and_split"], [3, 2, 1, "", "transition"], [3, 2, 1, "", "update"]], "suffix_tree.util": [[12, 6, 1, "", "DEBUG"], [12, 6, 1, "", "DEBUG_DOT"], [12, 6, 1, "", "DEBUG_LABELS"], [12, 1, 1, "", "Path"], [12, 1, 1, "", "UniqueEndChar"], [12, 4, 1, "", "debug"], [12, 4, 1, "", "is_debug"], [12, 6, 1, "", "min_debug_depth"], [12, 4, 1, "", "ukko_str"]], "suffix_tree.util.Path": [[12, 2, 1, "", "__getitem__"], [12, 2, 1, "", "__init__"], [12, 2, 1, "", "__lt__"], [12, 2, 1, "", "__str__"]], "suffix_tree.util.UniqueEndChar": [[12, 2, 1, "", "__init__"], [12, 2, 1, "", "__str__"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:attribute", "4": "py:function", "5": "py:property", "6": "py:data"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "attribute", "Python attribute"], "4": ["py", "function", "Python function"], "5": ["py", "property", "Python property"], "6": ["py", "data", "Python data"]}, "titleterms": {"base": 0, "class": 0, "builder": [0, 1, 2, 3, 4], "mccreight": 1, "naiv": 2, "ukkonen": 3, "content": [4, 6], "exampl": 5, "suffix": 6, "tree": [6, 11], "document": 6, "indic": 6, "tabl": 6, "lca": 7, "mixin": 7, "node": 8, "perform": 9, "python": 9, "3": 9, "10": 9, "7": 9, "pypi": 9, "9": 9, "refer": 10, "util": 12}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 60}, "alltitles": {"Builders": [[4, "builders"]], "Contents:": [[4, null], [6, null]], "Examples": [[5, "examples"]], "suffix-tree Documentation": [[6, "suffix-tree-documentation"]], "Indices and tables": [[6, "indices-and-tables"]], "Performance": [[9, "performance"]], "Python 3.10.7": [[9, "python-3-10-7"]], "PyPy 7.3.9": [[9, "pypy-7-3-9"]], "References": [[10, "references"]], "Base Class for Builders": [[0, "module-suffix_tree.builder"]], "McCreight Builder": [[1, "mccreight-builder"]], "Naive Builder": [[2, "module-suffix_tree.naive"]], "Ukkonen Builder": [[3, "ukkonen-builder"]], "LCA Mixin": [[7, "module-suffix_tree.lca_mixin"]], "Node": [[8, "module-suffix_tree.node"]], "Tree": [[11, "module-suffix_tree.tree"]], "Utilities": [[12, "module-suffix_tree.util"]]}, "indexentries": {"builder (class in suffix_tree.builder)": [[0, "suffix_tree.builder.Builder"]], "__init__() (builder method)": [[0, "suffix_tree.builder.Builder.__init__"], [3, "suffix_tree.ukkonen.Builder.__init__"]], "build() (builder method)": [[0, "suffix_tree.builder.Builder.build"], [1, "suffix_tree.mccreight.Builder.build"], [2, "suffix_tree.naive.Builder.build"], [3, "suffix_tree.ukkonen.Builder.build"]], "module": [[0, "module-suffix_tree.builder"], [1, "module-suffix_tree.mccreight"], [2, "module-suffix_tree.naive"], [3, "module-suffix_tree.ukkonen"], [7, "module-suffix_tree.lca_mixin"], [8, "module-suffix_tree.node"], [11, "module-suffix_tree.tree"], [12, "module-suffix_tree.util"]], "set_progress_function() (builder method)": [[0, "suffix_tree.builder.Builder.set_progress_function"]], "suffix_tree.builder": [[0, "module-suffix_tree.builder"]], "builder (class in suffix_tree.mccreight)": [[1, "suffix_tree.mccreight.Builder"]], "suffix_tree.mccreight": [[1, "module-suffix_tree.mccreight"]], "builder (class in suffix_tree.naive)": [[2, "suffix_tree.naive.Builder"]], "suffix_tree.naive": [[2, "module-suffix_tree.naive"]], "builder (class in suffix_tree.ukkonen)": [[3, "suffix_tree.ukkonen.Builder"]], "canonize() (builder method)": [[3, "suffix_tree.ukkonen.Builder.canonize"]], "suffix_tree.ukkonen": [[3, "module-suffix_tree.ukkonen"]], "test_and_split() (builder method)": [[3, "suffix_tree.ukkonen.Builder.test_and_split"]], "transition() (builder method)": [[3, "suffix_tree.ukkonen.Builder.transition"]], "update() (builder method)": [[3, "suffix_tree.ukkonen.Builder.update"]], "a (internal attribute)": [[7, "suffix_tree.lca_mixin.Internal.A"]], "a (leaf attribute)": [[7, "suffix_tree.lca_mixin.Leaf.A"]], "a (node attribute)": [[7, "suffix_tree.lca_mixin.Node.A"]], "i (internal attribute)": [[7, "suffix_tree.lca_mixin.Internal.I"]], "i (leaf attribute)": [[7, "suffix_tree.lca_mixin.Leaf.I"]], "i (node attribute)": [[7, "suffix_tree.lca_mixin.Node.I"]], "internal (class in suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.Internal"]], "leaf (class in suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.Leaf"]], "node (class in suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.Node"]], "tree (class in suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.Tree"]], "__init__() (node method)": [[7, "suffix_tree.lca_mixin.Node.__init__"], [8, "suffix_tree.node.Node.__init__"]], "__init__() (tree method)": [[7, "suffix_tree.lca_mixin.Tree.__init__"], [11, "suffix_tree.tree.Tree.__init__"]], "__str__() (internal method)": [[7, "suffix_tree.lca_mixin.Internal.__str__"], [8, "suffix_tree.node.Internal.__str__"]], "__str__() (leaf method)": [[7, "suffix_tree.lca_mixin.Leaf.__str__"], [8, "suffix_tree.node.Leaf.__str__"]], "compute_a() (internal method)": [[7, "suffix_tree.lca_mixin.Internal.compute_A"]], "compute_a() (leaf method)": [[7, "suffix_tree.lca_mixin.Leaf.compute_A"]], "compute_a() (node method)": [[7, "suffix_tree.lca_mixin.Node.compute_A"]], "compute_i_and_l() (internal method)": [[7, "suffix_tree.lca_mixin.Internal.compute_I_and_L"]], "compute_i_and_l() (leaf method)": [[7, "suffix_tree.lca_mixin.Leaf.compute_I_and_L"]], "compute_i_and_l() (node method)": [[7, "suffix_tree.lca_mixin.Node.compute_I_and_L"]], "h() (in module suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.h"]], "lca() (tree method)": [[7, "suffix_tree.lca_mixin.Tree.lca"]], "lca_id (internal attribute)": [[7, "suffix_tree.lca_mixin.Internal.lca_id"]], "lca_id (leaf attribute)": [[7, "suffix_tree.lca_mixin.Leaf.lca_id"]], "lca_id (node attribute)": [[7, "suffix_tree.lca_mixin.Node.lca_id"]], "msb() (in module suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.msb"]], "nlz() (in module suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.nlz"]], "nodemap (tree attribute)": [[7, "suffix_tree.lca_mixin.Tree.nodemap"]], "prepare_lca() (internal method)": [[7, "suffix_tree.lca_mixin.Internal.prepare_lca"]], "prepare_lca() (leaf method)": [[7, "suffix_tree.lca_mixin.Leaf.prepare_lca"]], "prepare_lca() (node method)": [[7, "suffix_tree.lca_mixin.Node.prepare_lca"]], "prepare_lca() (tree method)": [[7, "suffix_tree.lca_mixin.Tree.prepare_lca"]], "suffix_tree.lca_mixin": [[7, "module-suffix_tree.lca_mixin"]], "uint() (in module suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.uint"]], "c (internal attribute)": [[8, "suffix_tree.node.Internal.C"]], "internal (class in suffix_tree.node)": [[8, "suffix_tree.node.Internal"]], "leaf (class in suffix_tree.node)": [[8, "suffix_tree.node.Leaf"]], "node (class in suffix_tree.node)": [[8, "suffix_tree.node.Node"]], "s (node attribute)": [[8, "suffix_tree.node.Node.S"]], "ukkonenleaf (class in suffix_tree.node)": [[8, "suffix_tree.node.UkkonenLeaf"]], "__getitem__() (node method)": [[8, "suffix_tree.node.Node.__getitem__"]], "__init__() (internal method)": [[8, "suffix_tree.node.Internal.__init__"]], "__init__() (leaf method)": [[8, "suffix_tree.node.Leaf.__init__"]], "__init__() (ukkonenleaf method)": [[8, "suffix_tree.node.UkkonenLeaf.__init__"]], "__str__() (node method)": [[8, "suffix_tree.node.Node.__str__"]], "add_position() (internal method)": [[8, "suffix_tree.node.Internal.add_position"]], "add_position() (leaf method)": [[8, "suffix_tree.node.Leaf.add_position"]], "add_position() (node method)": [[8, "suffix_tree.node.Node.add_position"]], "children (internal attribute)": [[8, "suffix_tree.node.Internal.children"]], "common_substrings() (internal method)": [[8, "suffix_tree.node.Internal.common_substrings"]], "common_substrings() (node method)": [[8, "suffix_tree.node.Node.common_substrings"]], "compute_c() (internal method)": [[8, "suffix_tree.node.Internal.compute_C"]], "compute_c() (leaf method)": [[8, "suffix_tree.node.Leaf.compute_C"]], "compute_c() (node method)": [[8, "suffix_tree.node.Node.compute_C"]], "compute_left_diverse() (internal method)": [[8, "suffix_tree.node.Internal.compute_left_diverse"]], "compute_left_diverse() (leaf method)": [[8, "suffix_tree.node.Leaf.compute_left_diverse"]], "compute_left_diverse() (node method)": [[8, "suffix_tree.node.Node.compute_left_diverse"]], "depth (ukkonenleaf property)": [[8, "suffix_tree.node.UkkonenLeaf.depth"]], "end (node attribute)": [[8, "suffix_tree.node.Node.end"]], "end (ukkonenleaf property)": [[8, "suffix_tree.node.UkkonenLeaf.end"]], "find_path() (internal method)": [[8, "suffix_tree.node.Internal.find_path"]], "get_positions() (node method)": [[8, "suffix_tree.node.Node.get_positions"]], "is_left_diverse (internal attribute)": [[8, "suffix_tree.node.Internal.is_left_diverse"]], "maximal_repeats() (internal method)": [[8, "suffix_tree.node.Internal.maximal_repeats"]], "maximal_repeats() (leaf method)": [[8, "suffix_tree.node.Leaf.maximal_repeats"]], "maximal_repeats() (node method)": [[8, "suffix_tree.node.Node.maximal_repeats"]], "name (node attribute)": [[8, "suffix_tree.node.Node.name"]], "parent (node attribute)": [[8, "suffix_tree.node.Node.parent"]], "post_order() (internal method)": [[8, "suffix_tree.node.Internal.post_order"]], "post_order() (leaf method)": [[8, "suffix_tree.node.Leaf.post_order"]], "post_order() (node method)": [[8, "suffix_tree.node.Node.post_order"]], "pre_order() (internal method)": [[8, "suffix_tree.node.Internal.pre_order"]], "pre_order() (leaf method)": [[8, "suffix_tree.node.Leaf.pre_order"]], "pre_order() (node method)": [[8, "suffix_tree.node.Node.pre_order"]], "split_edge() (internal method)": [[8, "suffix_tree.node.Internal.split_edge"]], "start (node attribute)": [[8, "suffix_tree.node.Node.start"]], "str_id (leaf attribute)": [[8, "suffix_tree.node.Leaf.str_id"]], "str_id (ukkonenleaf attribute)": [[8, "suffix_tree.node.UkkonenLeaf.str_id"]], "suffix_link (internal attribute)": [[8, "suffix_tree.node.Internal.suffix_link"]], "suffix_tree.node": [[8, "module-suffix_tree.node"]], "to_dot() (node method)": [[8, "suffix_tree.node.Node.to_dot"]], "tree (class in suffix_tree.tree)": [[11, "suffix_tree.tree.Tree"]], "add() (tree method)": [[11, "suffix_tree.tree.Tree.add"]], "common_substrings() (tree method)": [[11, "suffix_tree.tree.Tree.common_substrings"]], "find() (tree method)": [[11, "suffix_tree.tree.Tree.find"]], "find_all() (tree method)": [[11, "suffix_tree.tree.Tree.find_all"]], "find_id() (tree method)": [[11, "suffix_tree.tree.Tree.find_id"]], "find_path() (tree method)": [[11, "suffix_tree.tree.Tree.find_path"]], "maximal_repeats() (tree method)": [[11, "suffix_tree.tree.Tree.maximal_repeats"]], "post_order() (tree method)": [[11, "suffix_tree.tree.Tree.post_order"]], "pre_order() (tree method)": [[11, "suffix_tree.tree.Tree.pre_order"]], "suffix_tree.tree": [[11, "module-suffix_tree.tree"]], "debug (in module suffix_tree.util)": [[12, "suffix_tree.util.DEBUG"]], "debug_dot (in module suffix_tree.util)": [[12, "suffix_tree.util.DEBUG_DOT"]], "debug_labels (in module suffix_tree.util)": [[12, "suffix_tree.util.DEBUG_LABELS"]], "path (class in suffix_tree.util)": [[12, "suffix_tree.util.Path"]], "uniqueendchar (class in suffix_tree.util)": [[12, "suffix_tree.util.UniqueEndChar"]], "__getitem__() (path method)": [[12, "suffix_tree.util.Path.__getitem__"]], "__init__() (path method)": [[12, "suffix_tree.util.Path.__init__"]], "__init__() (uniqueendchar method)": [[12, "suffix_tree.util.UniqueEndChar.__init__"]], "__lt__() (path method)": [[12, "suffix_tree.util.Path.__lt__"]], "__str__() (path method)": [[12, "suffix_tree.util.Path.__str__"]], "__str__() (uniqueendchar method)": [[12, "suffix_tree.util.UniqueEndChar.__str__"]], "debug() (in module suffix_tree.util)": [[12, "suffix_tree.util.debug"]], "is_debug() (in module suffix_tree.util)": [[12, "suffix_tree.util.is_debug"]], "min_debug_depth (in module suffix_tree.util)": [[12, "suffix_tree.util.min_debug_depth"]], "suffix_tree.util": [[12, "module-suffix_tree.util"]], "ukko_str() (in module suffix_tree.util)": [[12, "suffix_tree.util.ukko_str"]]}}) \ No newline at end of file +Search.setIndex({"docnames": ["builder/builder", "builder/mccreight", "builder/naive", "builder/ukkonen", "builders", "examples", "index", "lca", "node", "performance", "references", "tree", "util"], "filenames": ["builder/builder.rst", "builder/mccreight.rst", "builder/naive.rst", "builder/ukkonen.rst", "builders.rst", "examples.rst", "index.rst", "lca.rst", "node.rst", "performance.rst", "references.rst", "tree.rst", "util.rst"], "titles": ["Base Class for Builders", "McCreight Builder", "Naive Builder", "Ukkonen Builder", "Builders", "Examples", "suffix-tree Documentation", "LCA Mixin", "Node", "Performance", "References", "Tree", "Utilities"], "terms": {"bf": 1, "": [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12], "i": [0, 1, 3, 4, 5, 6, 7, 8, 11, 12], "1": [1, 3, 5, 7, 8, 11, 12], "t_": [1, 8], "imath": 1, "2": [1, 2, 3, 5, 8, 10, 11], "suf": 1, "jmath": 1, "head": [1, 3], "tail": 1, "b": [1, 3, 5, 7, 8, 11], "alpha": [1, 8, 11], "beta": [1, 11], "gamma": 1, "delta": 1, "rho": 1, "chi": 1, "x": [1, 3, 5, 7, 8, 11], "The": [0, 1, 3, 4, 6, 8, 11], "origin": 1, "mathemat": 1, "precis": 1, "exposit": 1, "blockquot": 1, "taken": 1, "from": [1, 3, 4, 5, 6, 7, 8, 11, 12], "excel": 1, "paper": [1, 3], "mccreight1976": [1, 3, 6, 10], "comment": 1, "ar": [1, 3, 6, 8, 9, 12], "me": 1, "try": [1, 3], "understand": [1, 3], "translat": 1, "languag": 1, "suit": 1, "mere": [1, 3], "mortal": [1, 3], "first": [1, 3, 7, 8, 12], "defin": [1, 8, 11], "extens": 1, "an": [1, 3, 7, 8, 11], "string": [1, 3, 6, 7, 8, 10, 11], "ani": [1, 3, 6, 7, 8, 11], "which": [1, 3, 4], "prefix": 1, "locu": [1, 3], "node": [1, 2, 3, 6, 7, 11, 12], "end": [1, 3, 8, 12], "path": [1, 3, 5, 6, 7, 8, 11, 12], "name": [1, 3, 8], "mai": [1, 3, 9], "exist": [1, 5], "extend": [1, 11], "shortest": [1, 3], "whose": 1, "thi": [0, 1, 2, 3, 4, 6, 7, 8, 9, 12], "itself": [1, 3, 7], "contract": [1, 3], "longest": [1, 11], "suffix": [1, 2, 3, 5, 7, 8, 9, 10, 11, 12], "begin": 1, "charact": [1, 3, 4, 8, 11], "posit": [1, 7, 8, 11, 12], "also": [1, 3, 8, 11, 12], "some": [1, 3, 7], "j": [1, 3], "equival": 1, "within": 1, "tree": [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 12], "we": [1, 3, 7, 8, 11, 12], "algorithm": [1, 2, 3, 6, 8, 9, 10], "insert": [1, 2, 3, 8], "all": [0, 1, 3, 5, 7, 8, 11], "order": 1, "In": [1, 3, 4, 7, 8], "each": [1, 3, 4, 8, 11, 12], "step": [1, 3, 5], "one": [1, 3, 4, 5, 6, 7, 8, 11], "creat": [1, 3, 8], "leaf": [1, 3, 6, 7, 8, 11], "most": [1, 3, 7], "intern": [0, 1, 2, 3, 6, 7, 8, 11], "For": [1, 7, 8, 11], "link": [1, 3], "next": [1, 3, 8], "To": [1, 3, 6], "search": [1, 3, 6], "root": [0, 1, 2, 3, 7, 8, 11], "until": 1, "get": [1, 3, 6, 7, 8, 11], "mismatch": 1, "If": [1, 3, 8, 12], "happen": 1, "call": [0, 1, 3, 7, 8, 11], "middl": [1, 3], "edg": [1, 3, 7, 8], "split": [1, 3, 8], "new": [1, 3, 8], "Then": 1, "append": [1, 8], "procedur": [1, 3], "slow": [1, 4], "becaus": [1, 8], "have": [1, 3, 4, 6, 8, 11], "start": [1, 3, 7, 8, 11, 12], "over": [1, 3, 4, 7], "again": 1, "show": 1, "u": [1, 3, 7, 10], "how": [1, 3, 12], "warp": 1, "linear": [1, 3, 6, 9], "time": [1, 2, 3, 6, 7, 9], "us": [1, 2, 3, 6, 7, 8, 9, 12], "rescan": [1, 3], "he": 1, "demonstr": 1, "can": [1, 3, 5, 6, 7, 8], "set": [0, 1, 6, 7, 8, 12], "exploit": 1, "lemma": [1, 7], "written": 1, "possibli": 1, "empti": [1, 3], "proof": 1, "By": [1, 8], "induct": 1, "suppos": [1, 11], "mean": 1, "both": [1, 3, 7, 9], "thu": [1, 3], "therefor": [1, 3, 8], "definit": [1, 7, 8, 11], "quad": 1, "squar": 1, "rephras": 1, "wa": [1, 3, 11], "find": [1, 3, 5, 8, 11], "c": [1, 5, 7, 8, 10, 11], "possibl": [1, 3], "onli": [1, 3, 4, 7, 8], "previou": 1, "diverg": 1, "But": 1, "must": [1, 3], "previous": 1, "relationship": 1, "auxiliari": [1, 8], "ad": [1, 3], "our": 1, "structur": 1, "nontermin": 1, "where": [1, 8, 11], "introduc": 1, "point": [1, 3, 8, 11], "note": [1, 8, 12], "never": 1, "subtre": [1, 7, 8], "These": 1, "enabl": 1, "do": [1, 4], "short": 1, "cut": 1, "ha": [1, 3, 4, 7, 8], "visit": [1, 8, 11], "follow": [1, 2, 3], "semiform": 1, "present": [1, 3, 4], "prove": 1, "p1": 1, "could": 1, "fail": 1, "valid": 1, "p2": 1, "properti": [1, 8], "clearli": 1, "obtain": 1, "now": 1, "doe": [1, 3, 6], "It": [1, 3, 6, 8], "descript": [1, 2], "substep": [1, 3], "A": [1, 2, 3, 5, 7, 8, 10, 11, 12], "let": [1, 3, 7], "write": [1, 12], "down": 1, "concaten": [1, 11], "three": [1, 3, 6, 7], "same": [1, 3], "wai": 1, "more": [1, 3, 12], "import": [1, 5, 7, 11], "when": [1, 8, 12], "part": [1, 12], "circuit": 1, "fast": [1, 3, 6], "forward": [1, 3], "third": 1, "scan": [1, 3], "And": 1, "last": [1, 3, 8], "go": [1, 3, 8], "ancestor": [1, 3, 6, 7], "self": [1, 7, 8, 12], "That": [1, 8, 11], "would": [1, 3, 11], "goto": 1, "don": [1, 8, 12], "t": [1, 3, 5, 7, 8, 12], "special": 1, "case": [1, 4], "identifi": [1, 3, 8], "repres": [1, 3, 8], "otherwis": 1, "guarante": 1, "choos": [1, 4], "appropri": 1, "two": [1, 3, 7, 8, 11], "goe": [1, 8], "nonempti": 1, "sinc": [1, 8, 9], "been": [1, 6], "construct": [1, 8, 10, 11, 12], "befor": [1, 8, 11], "its": [1, 8, 11], "second": [1, 3], "save": [1, 7, 8], "trick": 1, "devis": 1, "what": [1, 3], "alreadi": [1, 3], "know": [1, 3], "match": [1, 8], "so": [1, 3, 7, 8], "need": [1, 3, 8, 12], "examin": 1, "decid": 1, "overshoot": 1, "length": [1, 5, 6, 8, 9, 11, 12], "usual": [1, 8], "found": [1, 11], "d": [1, 5, 11], "kei": [1, 11], "idea": [1, 6], "m": [1, 11], "sequenc": [0, 1, 2, 3, 5, 6, 8, 9, 10, 11, 12], "arc": [1, 3], "downward": 1, "spell": [1, 11], "out": [1, 3, 11, 12], "child": [1, 3, 8], "lead": [1, 3, 7, 8], "shall": 1, "f": [1, 3, 5, 8, 11], "compar": 1, "longer": [1, 8], "recurs": [1, 8], "begun": 1, "shorter": 1, "complet": 1, "accomplish": 1, "number": [1, 7, 8, 11], "encount": 1, "back": 1, "naiv": [1, 4, 6, 11], "unmatch": 1, "rest": [1, 3], "increment": 1, "current": [0, 1, 8, 11], "undefin": 1, "hypothesi": 1, "establish": 1, "truth": 1, "deeper": [1, 8], "major": 1, "differ": [1, 3, 6, 8, 11], "between": [1, 11], "known": 1, "beforehand": [1, 3], "while": [1, 3], "travel": 1, "respons": 1, "left": [1, 3, 8, 11], "right": [1, 3, 7, 8, 11], "fall": 1, "constraint": 1, "s1": 1, "trek": 1, "final": [1, 3], "label": [1, 3, 8, 11, 12], "termin": 1, "finish": 1, "http": [1, 3, 6, 7, 10], "www": [1, 7, 10], "helsinki": [1, 10], "fi": [1, 10], "tpkarkka": 1, "opetu": 1, "10": [1, 5, 6, 10], "spa": 1, "lectur": 1, "pdf": [1, 10], "veri": [3, 6], "similar": 3, "mccreight": [3, 4, 6, 8, 9, 10], "ukkonen1995": [3, 6, 8, 10], "english": 3, "phase": [3, 8, 11, 12], "round": [0, 3, 4], "implicit": [3, 8], "state": [3, 8], "substr": [3, 5, 8, 11], "explicit": 3, "branch": 3, "transit": [3, 8], "function": [0, 3, 8, 11, 12], "pointer": [3, 8], "activ": 3, "canon": 3, "represent": [3, 7], "parent": [3, 8], "t_i": 3, "whole": 3, "dot": [3, 8, 12], "t_n": 3, "build": [0, 1, 2, 3, 6, 9, 11], "python": [3, 6, 8], "gener": [1, 3, 6, 8, 11], "readi": [3, 4], "constant": [3, 6, 7], "after": [3, 4, 8, 11], "easier": 3, "per": [3, 7, 8], "clear": 3, "mani": [3, 7], "fig": 3, "3": [3, 5, 6, 7, 11], "leav": [3, 8], "preced": 3, "noth": 3, "annot": 3, "subsequ": 3, "indic": [0, 3, 8, 12], "k": [3, 5, 7, 8, 11], "p": 3, "suffici": 3, "uniqu": [3, 7], "refer": [3, 6, 7], "instead": [3, 8], "paramet": [0, 1, 2, 3, 8, 11], "pair": [3, 11], "prefer": [3, 12], "them": [3, 8, 12], "problem": [3, 7], "0": [3, 7, 12], "beyond": 3, "conclus": 3, "becom": 3, "treat": 3, "trie": 3, "automaton": 3, "describ": 3, "everi": [0, 3], "convers": 3, "true": [3, 5, 9, 11, 12], "abc": [3, 5, 11], "overlin": 3, "compress": 3, "without": 3, "those": [3, 9], "than": [3, 8, 12], "As": 3, "consequ": 3, "had": 3, "remov": 3, "still": 3, "retain": 3, "alwai": [3, 4], "ones": 3, "made": 3, "explict": 3, "tripl": 3, "There": 3, "rememb": 3, "nearest": 3, "abov": [3, 8], "g": [3, 8], "r": [3, 8], "bar": 3, "y": [3, 7], "anoth": 3, "encod": 3, "minu": 3, "symbol": [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12], "you": [0, 3, 6, 7], "cacao": 3, "acao": 3, "cao": 3, "ao": 3, "aux": 3, "open": [3, 8], "grow": [3, 8], "automat": 3, "whenev": 3, "boundari": 3, "chain": 3, "deepest": [3, 7, 8], "ist": 3, "add": [0, 1, 2, 3, 5, 8, 11], "reach": 3, "plain": 3, "stackoverflow": 3, "com": 3, "question": 3, "9452701": 3, "should": [0, 4, 8, 12], "tl": 4, "dr": 4, "fastest": 4, "implement": [1, 2, 3, 4, 6, 7, 8, 9, 12], "ukkonen": [4, 6, 8, 9, 10, 11, 12], "real": 4, "advantag": 4, "except": 4, "your": 4, "come": 4, "sourc": 4, "rel": 4, "cpu": 4, "arriv": 4, "educ": 4, "purpos": 4, "base": [4, 6, 8], "class": [1, 2, 3, 4, 6, 7, 8, 11, 12], "instal": [5, 6], "pip": 5, "librari": [5, 9], "suffix_tre": [5, 7, 11], "initi": [5, 11, 12], "xabxac": [5, 7, 11], "awyawxawxz": [5, 7, 11], "Or": 5, "dictionari": [5, 8, 9, 11], "queri": [5, 6, 7], "abx": [5, 11], "awx": [5, 11], "fals": [5, 11, 12], "find_id": [5, 11], "enumer": 5, "hit": 5, "id_": [0, 1, 2, 3, 5, 11, 12], "find_al": [5, 11], "xa": 5, "print": [5, 11, 12], "str": [5, 7, 8, 11, 12], "w": [5, 7, 11], "z": [5, 11], "contain": [5, 7, 8, 11], "kind": 5, "hashabl": [0, 1, 2, 3, 5, 6, 8, 11, 12], "object": [0, 1, 2, 3, 5, 8, 11, 12], "hello": 5, "world": 5, "frozenset": 5, "common": [5, 6, 7, 8, 11], "sandollar": [5, 11], "sandlot": [5, 11], "handler": [5, 11], "grand": [5, 11], "e": [5, 7, 11], "pantri": [5, 11], "common_substr": [5, 8, 11], "4": [2, 5, 7, 11], "n": [2, 5, 7, 8, 11], "5": [2, 5, 7, 8, 11], "maxim": [5, 8, 11], "repeat": [5, 8, 11], "sort": [5, 11, 12], "maximal_repeat": [5, 8, 11], "lowest": [6, 7], "retriev": [6, 7], "work": 6, "just": [6, 8], "item": [6, 8], "pure": 6, "proport": 6, "input": [3, 6, 9], "builder": [6, 11], "mathcal": [2, 6, 7, 8, 9], "o": [2, 6, 9], "lvert": [6, 9], "rvert": [6, 9], "non": 6, "Being": 6, "nor": 6, "memori": 6, "effici": 6, "take": 6, "rough": 6, "perform": 6, "under": 6, "best": 6, "turn": 6, "optim": 6, "pypi": 6, "org": [6, 7, 10], "project": 6, "exampl": [6, 7], "lca": [6, 8], "mixin": 6, "util": 6, "7": [6, 7, 8, 11], "9": [6, 7], "index": [0, 6], "modul": [1, 3, 6], "page": [2, 6, 7, 8, 11], "being": 9, "strictli": 9, "especi": 9, "larg": 9, "alphabet": 9, "store": 9, "gusfield1997": [2, 7, 8, 10, 11], "gusfield": 10, "dan": 10, "1997": 10, "cambridg": 10, "univers": 10, "press": 10, "edward": 10, "space": 10, "econom": 10, "journal": 10, "associ": 10, "comput": [7, 10, 11], "machineri": 10, "vol": 10, "23": 10, "No": 10, "april": 10, "1976": 10, "dl": 10, "acm": 10, "doi": 10, "1145": 10, "321941": 10, "321946": 10, "esko": 10, "On": 10, "line": 10, "1995": 10, "algorithmica": 10, "14": 10, "249": 10, "60": 10, "suffixt1withfig": 10, "warren2013": [7, 10], "warren": 10, "h": [6, 7, 10], "hacker": 10, "delight": 10, "2nd": 10, "edit": 10, "2013": 10, "pearson": 10, "westford": 10, "ma": 10, "__init__": [0, 3, 7, 8, 11, 12], "iter": [0, 1, 2, 3, 8], "none": [0, 1, 2, 3, 8, 11, 12], "set_progress_funct": 0, "tick": 0, "int": [0, 3, 8, 11, 12], "callback": 0, "callabl": [0, 8, 11], "progress": [0, 11], "chang": [0, 3], "adapt": [1, 3], "id": [1, 2, 3, 7, 8, 11], "close": 2, "93": 2, "tupl": [3, 8, 11], "t_k": 3, "return": [3, 7, 8, 11, 12], "test_and_split": 3, "bool": [3, 8, 11, 12], "test": 3, "endpoint": 3, "eventu": 3, "whether": 3, "strie": 3, "given": [3, 7, 8, 11], "result": 3, "output": [3, 8], "closest": 3, "t_p": 3, "henc": 3, "geq": 3, "updat": 3, "list": [3, 8, 11], "transform": 3, "stree": [3, 8], "group": 3, "mention": 3, "provid": 3, "s_": 3, "actual": [3, 8], "remain": 3, "prime": 3, "itersymbol": 3, "ukkonenleaf": [6, 8], "uint": [6, 7], "nlz": [6, 7], "msb": [6, 7], "debug": [6, 7, 8, 12], "debug_dot": [6, 12], "debug_label": [6, 12], "uniqueendchar": [6, 12], "min_debug_depth": [6, 12], "is_debug": [6, 12], "ukko_str": [6, 12], "With": 7, "abil": 7, "solv": 7, "addit": 7, "196": 7, "v": [7, 8], "proper": 7, "chapter": 7, "8": 7, "181ff": 7, "convert": 7, "unsign": 7, "32": 7, "bit": 7, "zero": 7, "word": 7, "0x1": 7, "31": 7, "0xff": 7, "24": 7, "0xffffffff": 7, "see": [7, 8, 11], "hackersdelight": 7, "hdcodetxt": 7, "txt": 7, "99ff": 7, "dignificat": 7, "signific": 7, "count": 7, "0xf": 7, "valu": [7, 8], "denot": 7, "least": [7, 8, 11], "binari": 7, "184ff": 7, "equal": [7, 11], "height": 7, "1000": 7, "four": 7, "allow": [7, 12], "retirev": 7, "inlin": [7, 8], "subclass": [7, 8], "lca_id": 7, "depth": [7, 8], "travers": [7, 8], "figur": 7, "182": 7, "maximum": 7, "includ": [7, 12], "run": 7, "6": [7, 8, 11], "187": 7, "a_v": 7, "map": 7, "188f": 7, "181": 7, "compute_a": 7, "compute_i_and_l": 7, "l": [7, 8, 11], "prepare_lca": 7, "counter": 7, "prepar": 7, "__str__": [7, 8, 12], "_d": 7, "nodemap": 7, "preprocess": 7, "abstract": 8, "report": 8, "graph": 8, "representaion": 8, "__getitem__": [8, 12], "symol": [8, 12], "slice": [8, 12], "neg": [8, 12], "compute_c": 8, "calcul": 8, "children": [8, 11], "compute_left_divers": 8, "divers": 8, "pre_ord": [8, 11], "walk": [8, 11], "visitor": [8, 11], "post_ord": [8, 11], "add_posit": 8, "get_posit": 8, "_v": 8, "dict": [8, 11], "to_dot": 8, "graphviz": 8, "format": 8, "fix": 8, "suffix_link": 8, "speed": 8, "up": 8, "corollari": 8, "_i": 8, "98": 8, "is_left_divers": 8, "cannot": 8, "12": [8, 11], "144ff": 8, "oper": 8, "distinct": [8, 11], "appear": 8, "127ff": [8, 11], "find_path": [8, 11], "absolut": 8, "split_edg": 8, "new_len": 8, "new_nod": 8, "str_id": 8, "exactli": [8, 11], "len": 8, "less": [8, 12], "concat": 8, "s_1": 8, "s_n": 8, "mutabl": 8, "implicitli": 8, "assum": 8, "Such": 8, "form": 8, "necessari": 8, "infti": 8, "pop": 8, "off": 8, "90f": 8, "type": 11, "featur": 11, "edgl": 11, "interrog": 11, "awyawxacxz": 11, "xac": 11, "option": 11, "default": 11, "regular": 11, "interv": 11, "dure": 11, "probabl": 11, "serv": 11, "occur": 11, "ab": 11, "tabl": 11, "want": 11, "entri": 11, "give": 11, "lk": 11, "ident": 11, "immedi": 11, "either": 11, "direct": 11, "destroi": 11, "143ff": 11, "lot": 12, "inform": 12, "file": 12, "potenti": 12, "confus": 12, "singleton": 12, "signal": 12, "deep": 12, "were": 12, "stack": 12, "emit": 12, "messag": 12, "interest": 12, "msg": 12, "arg": 12, "kwarg": 12, "stderr": 12, "notat": 12, "__lt__": 12, "other": 12, "conveni": 12, "sortabl": 12, "Not": 12, "data": 11}, "objects": {"suffix_tree": [[0, 0, 0, "-", "builder"], [7, 0, 0, "-", "lca_mixin"], [1, 0, 0, "-", "mccreight"], [2, 0, 0, "-", "naive"], [8, 0, 0, "-", "node"], [11, 0, 0, "-", "tree"], [3, 0, 0, "-", "ukkonen"], [12, 0, 0, "-", "util"]], "suffix_tree.builder": [[0, 1, 1, "", "Builder"]], "suffix_tree.builder.Builder": [[0, 2, 1, "", "__init__"], [0, 2, 1, "", "build"], [0, 2, 1, "", "set_progress_function"]], "suffix_tree.lca_mixin": [[7, 1, 1, "", "Internal"], [7, 1, 1, "", "Leaf"], [7, 1, 1, "", "Node"], [7, 1, 1, "", "Tree"], [7, 4, 1, "", "h"], [7, 4, 1, "", "msb"], [7, 4, 1, "", "nlz"], [7, 4, 1, "", "uint"]], "suffix_tree.lca_mixin.Internal": [[7, 3, 1, "", "A"], [7, 3, 1, "", "I"], [7, 2, 1, "", "__str__"], [7, 2, 1, "", "compute_A"], [7, 2, 1, "", "compute_I_and_L"], [7, 3, 1, "", "lca_id"], [7, 2, 1, "", "prepare_lca"]], "suffix_tree.lca_mixin.Leaf": [[7, 3, 1, "", "A"], [7, 3, 1, "", "I"], [7, 2, 1, "", "__str__"], [7, 2, 1, "", "compute_A"], [7, 2, 1, "", "compute_I_and_L"], [7, 3, 1, "", "lca_id"], [7, 2, 1, "", "prepare_lca"]], "suffix_tree.lca_mixin.Node": [[7, 3, 1, "", "A"], [7, 3, 1, "", "I"], [7, 2, 1, "", "__init__"], [7, 2, 1, "", "compute_A"], [7, 2, 1, "", "compute_I_and_L"], [7, 3, 1, "", "lca_id"], [7, 2, 1, "", "prepare_lca"]], "suffix_tree.lca_mixin.Tree": [[7, 2, 1, "", "__init__"], [7, 2, 1, "", "lca"], [7, 3, 1, "", "nodemap"], [7, 2, 1, "", "prepare_lca"]], "suffix_tree.mccreight": [[1, 1, 1, "", "Builder"]], "suffix_tree.mccreight.Builder": [[1, 2, 1, "", "build"]], "suffix_tree.naive": [[2, 1, 1, "", "Builder"]], "suffix_tree.naive.Builder": [[2, 2, 1, "", "build"]], "suffix_tree.node": [[8, 1, 1, "", "Internal"], [8, 1, 1, "", "Leaf"], [8, 1, 1, "", "Node"], [8, 1, 1, "", "UkkonenLeaf"]], "suffix_tree.node.Internal": [[8, 3, 1, "", "C"], [8, 2, 1, "", "__init__"], [8, 2, 1, "", "__str__"], [8, 2, 1, "", "add_position"], [8, 3, 1, "", "children"], [8, 2, 1, "", "common_substrings"], [8, 2, 1, "", "compute_C"], [8, 2, 1, "", "compute_left_diverse"], [8, 2, 1, "", "find_path"], [8, 3, 1, "", "is_left_diverse"], [8, 2, 1, "", "maximal_repeats"], [8, 2, 1, "", "post_order"], [8, 2, 1, "", "pre_order"], [8, 2, 1, "", "split_edge"], [8, 3, 1, "", "suffix_link"]], "suffix_tree.node.Leaf": [[8, 2, 1, "", "__init__"], [8, 2, 1, "", "__str__"], [8, 2, 1, "", "add_position"], [8, 2, 1, "", "compute_C"], [8, 2, 1, "", "compute_left_diverse"], [8, 2, 1, "", "maximal_repeats"], [8, 2, 1, "", "post_order"], [8, 2, 1, "", "pre_order"], [8, 3, 1, "", "str_id"]], "suffix_tree.node.Node": [[8, 3, 1, "", "S"], [8, 2, 1, "", "__getitem__"], [8, 2, 1, "", "__init__"], [8, 2, 1, "", "__str__"], [8, 2, 1, "", "add_position"], [8, 2, 1, "", "common_substrings"], [8, 2, 1, "", "compute_C"], [8, 2, 1, "", "compute_left_diverse"], [8, 3, 1, "", "end"], [8, 2, 1, "", "get_positions"], [8, 2, 1, "", "maximal_repeats"], [8, 3, 1, "", "name"], [8, 3, 1, "", "parent"], [8, 2, 1, "", "post_order"], [8, 2, 1, "", "pre_order"], [8, 3, 1, "", "start"], [8, 2, 1, "", "to_dot"]], "suffix_tree.node.UkkonenLeaf": [[8, 2, 1, "", "__init__"], [8, 5, 1, "", "depth"], [8, 5, 1, "", "end"], [8, 3, 1, "", "str_id"]], "suffix_tree.tree": [[11, 1, 1, "", "Tree"]], "suffix_tree.tree.Tree": [[11, 2, 1, "", "__init__"], [11, 2, 1, "", "add"], [11, 2, 1, "", "common_substrings"], [11, 2, 1, "", "find"], [11, 2, 1, "", "find_all"], [11, 2, 1, "", "find_id"], [11, 2, 1, "", "find_path"], [11, 2, 1, "", "maximal_repeats"], [11, 2, 1, "", "post_order"], [11, 2, 1, "", "pre_order"]], "suffix_tree.ukkonen": [[3, 1, 1, "", "Builder"]], "suffix_tree.ukkonen.Builder": [[3, 2, 1, "", "__init__"], [3, 2, 1, "", "build"], [3, 2, 1, "", "canonize"], [3, 2, 1, "", "test_and_split"], [3, 2, 1, "", "transition"], [3, 2, 1, "", "update"]], "suffix_tree.util": [[12, 6, 1, "", "DEBUG"], [12, 6, 1, "", "DEBUG_DOT"], [12, 6, 1, "", "DEBUG_LABELS"], [12, 1, 1, "", "Path"], [12, 1, 1, "", "UniqueEndChar"], [12, 4, 1, "", "debug"], [12, 4, 1, "", "is_debug"], [12, 6, 1, "", "min_debug_depth"], [12, 4, 1, "", "ukko_str"]], "suffix_tree.util.Path": [[12, 2, 1, "", "__getitem__"], [12, 2, 1, "", "__init__"], [12, 2, 1, "", "__lt__"], [12, 2, 1, "", "__str__"]], "suffix_tree.util.UniqueEndChar": [[12, 2, 1, "", "__init__"], [12, 2, 1, "", "__str__"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:attribute", "4": "py:function", "5": "py:property", "6": "py:data"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "attribute", "Python attribute"], "4": ["py", "function", "Python function"], "5": ["py", "property", "Python property"], "6": ["py", "data", "Python data"]}, "titleterms": {"base": 0, "class": 0, "builder": [0, 1, 2, 3, 4], "mccreight": 1, "naiv": 2, "ukkonen": 3, "content": [4, 6], "exampl": 5, "suffix": 6, "tree": [6, 11], "document": 6, "indic": 6, "tabl": 6, "lca": 7, "mixin": 7, "node": 8, "perform": 9, "python": 9, "3": 9, "10": 9, "7": 9, "pypi": 9, "9": 9, "refer": 10, "util": 12}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 60}, "alltitles": {"Builders": [[4, "builders"]], "Contents:": [[4, null], [6, null]], "Examples": [[5, "examples"]], "suffix-tree Documentation": [[6, "suffix-tree-documentation"]], "Indices and tables": [[6, "indices-and-tables"]], "Performance": [[9, "performance"]], "Python 3.10.7": [[9, "python-3-10-7"]], "PyPy 7.3.9": [[9, "pypy-7-3-9"]], "References": [[10, "references"]], "McCreight Builder": [[1, "mccreight-builder"]], "Naive Builder": [[2, "module-suffix_tree.naive"]], "Ukkonen Builder": [[3, "ukkonen-builder"]], "LCA Mixin": [[7, "module-suffix_tree.lca_mixin"]], "Node": [[8, "module-suffix_tree.node"]], "Utilities": [[12, "module-suffix_tree.util"]], "Base Class for Builders": [[0, "module-suffix_tree.builder"]], "Tree": [[11, "module-suffix_tree.tree"]]}, "indexentries": {"builder (class in suffix_tree.builder)": [[0, "suffix_tree.builder.Builder"]], "__init__() (builder method)": [[0, "suffix_tree.builder.Builder.__init__"], [3, "suffix_tree.ukkonen.Builder.__init__"]], "build() (builder method)": [[0, "suffix_tree.builder.Builder.build"], [1, "suffix_tree.mccreight.Builder.build"], [2, "suffix_tree.naive.Builder.build"], [3, "suffix_tree.ukkonen.Builder.build"]], "module": [[0, "module-suffix_tree.builder"], [1, "module-suffix_tree.mccreight"], [2, "module-suffix_tree.naive"], [3, "module-suffix_tree.ukkonen"], [7, "module-suffix_tree.lca_mixin"], [8, "module-suffix_tree.node"], [11, "module-suffix_tree.tree"], [12, "module-suffix_tree.util"]], "set_progress_function() (builder method)": [[0, "suffix_tree.builder.Builder.set_progress_function"]], "suffix_tree.builder": [[0, "module-suffix_tree.builder"]], "builder (class in suffix_tree.mccreight)": [[1, "suffix_tree.mccreight.Builder"]], "suffix_tree.mccreight": [[1, "module-suffix_tree.mccreight"]], "builder (class in suffix_tree.naive)": [[2, "suffix_tree.naive.Builder"]], "suffix_tree.naive": [[2, "module-suffix_tree.naive"]], "builder (class in suffix_tree.ukkonen)": [[3, "suffix_tree.ukkonen.Builder"]], "canonize() (builder method)": [[3, "suffix_tree.ukkonen.Builder.canonize"]], "suffix_tree.ukkonen": [[3, "module-suffix_tree.ukkonen"]], "test_and_split() (builder method)": [[3, "suffix_tree.ukkonen.Builder.test_and_split"]], "transition() (builder method)": [[3, "suffix_tree.ukkonen.Builder.transition"]], "update() (builder method)": [[3, "suffix_tree.ukkonen.Builder.update"]], "a (internal attribute)": [[7, "suffix_tree.lca_mixin.Internal.A"]], "a (leaf attribute)": [[7, "suffix_tree.lca_mixin.Leaf.A"]], "a (node attribute)": [[7, "suffix_tree.lca_mixin.Node.A"]], "i (internal attribute)": [[7, "suffix_tree.lca_mixin.Internal.I"]], "i (leaf attribute)": [[7, "suffix_tree.lca_mixin.Leaf.I"]], "i (node attribute)": [[7, "suffix_tree.lca_mixin.Node.I"]], "internal (class in suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.Internal"]], "leaf (class in suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.Leaf"]], "node (class in suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.Node"]], "tree (class in suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.Tree"]], "__init__() (node method)": [[7, "suffix_tree.lca_mixin.Node.__init__"], [8, "suffix_tree.node.Node.__init__"]], "__init__() (tree method)": [[7, "suffix_tree.lca_mixin.Tree.__init__"], [11, "suffix_tree.tree.Tree.__init__"]], "__str__() (internal method)": [[7, "suffix_tree.lca_mixin.Internal.__str__"], [8, "suffix_tree.node.Internal.__str__"]], "__str__() (leaf method)": [[7, "suffix_tree.lca_mixin.Leaf.__str__"], [8, "suffix_tree.node.Leaf.__str__"]], "compute_a() (internal method)": [[7, "suffix_tree.lca_mixin.Internal.compute_A"]], "compute_a() (leaf method)": [[7, "suffix_tree.lca_mixin.Leaf.compute_A"]], "compute_a() (node method)": [[7, "suffix_tree.lca_mixin.Node.compute_A"]], "compute_i_and_l() (internal method)": [[7, "suffix_tree.lca_mixin.Internal.compute_I_and_L"]], "compute_i_and_l() (leaf method)": [[7, "suffix_tree.lca_mixin.Leaf.compute_I_and_L"]], "compute_i_and_l() (node method)": [[7, "suffix_tree.lca_mixin.Node.compute_I_and_L"]], "h() (in module suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.h"]], "lca() (tree method)": [[7, "suffix_tree.lca_mixin.Tree.lca"]], "lca_id (internal attribute)": [[7, "suffix_tree.lca_mixin.Internal.lca_id"]], "lca_id (leaf attribute)": [[7, "suffix_tree.lca_mixin.Leaf.lca_id"]], "lca_id (node attribute)": [[7, "suffix_tree.lca_mixin.Node.lca_id"]], "msb() (in module suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.msb"]], "nlz() (in module suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.nlz"]], "nodemap (tree attribute)": [[7, "suffix_tree.lca_mixin.Tree.nodemap"]], "prepare_lca() (internal method)": [[7, "suffix_tree.lca_mixin.Internal.prepare_lca"]], "prepare_lca() (leaf method)": [[7, "suffix_tree.lca_mixin.Leaf.prepare_lca"]], "prepare_lca() (node method)": [[7, "suffix_tree.lca_mixin.Node.prepare_lca"]], "prepare_lca() (tree method)": [[7, "suffix_tree.lca_mixin.Tree.prepare_lca"]], "suffix_tree.lca_mixin": [[7, "module-suffix_tree.lca_mixin"]], "uint() (in module suffix_tree.lca_mixin)": [[7, "suffix_tree.lca_mixin.uint"]], "c (internal attribute)": [[8, "suffix_tree.node.Internal.C"]], "internal (class in suffix_tree.node)": [[8, "suffix_tree.node.Internal"]], "leaf (class in suffix_tree.node)": [[8, "suffix_tree.node.Leaf"]], "node (class in suffix_tree.node)": [[8, "suffix_tree.node.Node"]], "s (node attribute)": [[8, "suffix_tree.node.Node.S"]], "ukkonenleaf (class in suffix_tree.node)": [[8, "suffix_tree.node.UkkonenLeaf"]], "__getitem__() (node method)": [[8, "suffix_tree.node.Node.__getitem__"]], "__init__() (internal method)": [[8, "suffix_tree.node.Internal.__init__"]], "__init__() (leaf method)": [[8, "suffix_tree.node.Leaf.__init__"]], "__init__() (ukkonenleaf method)": [[8, "suffix_tree.node.UkkonenLeaf.__init__"]], "__str__() (node method)": [[8, "suffix_tree.node.Node.__str__"]], "add_position() (internal method)": [[8, "suffix_tree.node.Internal.add_position"]], "add_position() (leaf method)": [[8, "suffix_tree.node.Leaf.add_position"]], "add_position() (node method)": [[8, "suffix_tree.node.Node.add_position"]], "children (internal attribute)": [[8, "suffix_tree.node.Internal.children"]], "common_substrings() (internal method)": [[8, "suffix_tree.node.Internal.common_substrings"]], "common_substrings() (node method)": [[8, "suffix_tree.node.Node.common_substrings"]], "compute_c() (internal method)": [[8, "suffix_tree.node.Internal.compute_C"]], "compute_c() (leaf method)": [[8, "suffix_tree.node.Leaf.compute_C"]], "compute_c() (node method)": [[8, "suffix_tree.node.Node.compute_C"]], "compute_left_diverse() (internal method)": [[8, "suffix_tree.node.Internal.compute_left_diverse"]], "compute_left_diverse() (leaf method)": [[8, "suffix_tree.node.Leaf.compute_left_diverse"]], "compute_left_diverse() (node method)": [[8, "suffix_tree.node.Node.compute_left_diverse"]], "depth (ukkonenleaf property)": [[8, "suffix_tree.node.UkkonenLeaf.depth"]], "end (node attribute)": [[8, "suffix_tree.node.Node.end"]], "end (ukkonenleaf property)": [[8, "suffix_tree.node.UkkonenLeaf.end"]], "find_path() (internal method)": [[8, "suffix_tree.node.Internal.find_path"]], "get_positions() (node method)": [[8, "suffix_tree.node.Node.get_positions"]], "is_left_diverse (internal attribute)": [[8, "suffix_tree.node.Internal.is_left_diverse"]], "maximal_repeats() (internal method)": [[8, "suffix_tree.node.Internal.maximal_repeats"]], "maximal_repeats() (leaf method)": [[8, "suffix_tree.node.Leaf.maximal_repeats"]], "maximal_repeats() (node method)": [[8, "suffix_tree.node.Node.maximal_repeats"]], "name (node attribute)": [[8, "suffix_tree.node.Node.name"]], "parent (node attribute)": [[8, "suffix_tree.node.Node.parent"]], "post_order() (internal method)": [[8, "suffix_tree.node.Internal.post_order"]], "post_order() (leaf method)": [[8, "suffix_tree.node.Leaf.post_order"]], "post_order() (node method)": [[8, "suffix_tree.node.Node.post_order"]], "pre_order() (internal method)": [[8, "suffix_tree.node.Internal.pre_order"]], "pre_order() (leaf method)": [[8, "suffix_tree.node.Leaf.pre_order"]], "pre_order() (node method)": [[8, "suffix_tree.node.Node.pre_order"]], "split_edge() (internal method)": [[8, "suffix_tree.node.Internal.split_edge"]], "start (node attribute)": [[8, "suffix_tree.node.Node.start"]], "str_id (leaf attribute)": [[8, "suffix_tree.node.Leaf.str_id"]], "str_id (ukkonenleaf attribute)": [[8, "suffix_tree.node.UkkonenLeaf.str_id"]], "suffix_link (internal attribute)": [[8, "suffix_tree.node.Internal.suffix_link"]], "suffix_tree.node": [[8, "module-suffix_tree.node"]], "to_dot() (node method)": [[8, "suffix_tree.node.Node.to_dot"]], "tree (class in suffix_tree.tree)": [[11, "suffix_tree.tree.Tree"]], "add() (tree method)": [[11, "suffix_tree.tree.Tree.add"]], "common_substrings() (tree method)": [[11, "suffix_tree.tree.Tree.common_substrings"]], "find() (tree method)": [[11, "suffix_tree.tree.Tree.find"]], "find_all() (tree method)": [[11, "suffix_tree.tree.Tree.find_all"]], "find_id() (tree method)": [[11, "suffix_tree.tree.Tree.find_id"]], "find_path() (tree method)": [[11, "suffix_tree.tree.Tree.find_path"]], "maximal_repeats() (tree method)": [[11, "suffix_tree.tree.Tree.maximal_repeats"]], "post_order() (tree method)": [[11, "suffix_tree.tree.Tree.post_order"]], "pre_order() (tree method)": [[11, "suffix_tree.tree.Tree.pre_order"]], "suffix_tree.tree": [[11, "module-suffix_tree.tree"]], "debug (in module suffix_tree.util)": [[12, "suffix_tree.util.DEBUG"]], "debug_dot (in module suffix_tree.util)": [[12, "suffix_tree.util.DEBUG_DOT"]], "debug_labels (in module suffix_tree.util)": [[12, "suffix_tree.util.DEBUG_LABELS"]], "path (class in suffix_tree.util)": [[12, "suffix_tree.util.Path"]], "uniqueendchar (class in suffix_tree.util)": [[12, "suffix_tree.util.UniqueEndChar"]], "__getitem__() (path method)": [[12, "suffix_tree.util.Path.__getitem__"]], "__init__() (path method)": [[12, "suffix_tree.util.Path.__init__"]], "__init__() (uniqueendchar method)": [[12, "suffix_tree.util.UniqueEndChar.__init__"]], "__lt__() (path method)": [[12, "suffix_tree.util.Path.__lt__"]], "__str__() (path method)": [[12, "suffix_tree.util.Path.__str__"]], "__str__() (uniqueendchar method)": [[12, "suffix_tree.util.UniqueEndChar.__str__"]], "debug() (in module suffix_tree.util)": [[12, "suffix_tree.util.debug"]], "is_debug() (in module suffix_tree.util)": [[12, "suffix_tree.util.is_debug"]], "min_debug_depth (in module suffix_tree.util)": [[12, "suffix_tree.util.min_debug_depth"]], "suffix_tree.util": [[12, "module-suffix_tree.util"]], "ukko_str() (in module suffix_tree.util)": [[12, "suffix_tree.util.ukko_str"]]}}) \ No newline at end of file diff --git a/docs/_images/badge-coverage.svg b/docs/_images/badge-coverage.svg new file mode 100644 index 0000000..97a04fe --- /dev/null +++ b/docs/_images/badge-coverage.svg @@ -0,0 +1 @@ +coverage: 100%coverage100% diff --git a/docs/_images/badge-py310.svg b/docs/_images/badge-py310.svg new file mode 100644 index 0000000..cfd4464 --- /dev/null +++ b/docs/_images/badge-py310.svg @@ -0,0 +1 @@ +py310: passingpy310passing \ No newline at end of file diff --git a/docs/_images/badge-py311.svg b/docs/_images/badge-py311.svg new file mode 100644 index 0000000..3117e6f --- /dev/null +++ b/docs/_images/badge-py311.svg @@ -0,0 +1 @@ +py311: passingpy311passing \ No newline at end of file diff --git a/docs/_images/badge-py312.svg b/docs/_images/badge-py312.svg new file mode 100644 index 0000000..9e0c17f --- /dev/null +++ b/docs/_images/badge-py312.svg @@ -0,0 +1 @@ +py312: passingpy312passing \ No newline at end of file diff --git a/docs/_images/badge-py39.svg b/docs/_images/badge-py39.svg new file mode 100644 index 0000000..7317a0f --- /dev/null +++ b/docs/_images/badge-py39.svg @@ -0,0 +1 @@ +py39: passingpy39passing \ No newline at end of file diff --git a/docs/_images/tox-pypy38.svg b/docs/_images/badge-pypy39.svg similarity index 83% rename from docs/_images/tox-pypy38.svg rename to docs/_images/badge-pypy39.svg index 31b2618..c4205d9 100644 --- a/docs/_images/tox-pypy38.svg +++ b/docs/_images/badge-pypy39.svg @@ -1 +1 @@ -pypy38: passingpypy38passing \ No newline at end of file +pypy39: passingpypy39passing \ No newline at end of file diff --git a/docs/_images/tox-py.svg b/docs/_images/tox-py.svg deleted file mode 100644 index cf62e1e..0000000 --- a/docs/_images/tox-py.svg +++ /dev/null @@ -1 +0,0 @@ -py: passingpypassing \ No newline at end of file diff --git a/docs/make_badges.py b/docs/make_badges.py deleted file mode 100755 index e182fb5..0000000 --- a/docs/make_badges.py +++ /dev/null @@ -1,64 +0,0 @@ -#!python3 - -# type: ignore - -import glob -import re -import sys - -from lxml import etree -import requests - -DESTDIR = "docs/" # physical -REFDIR = "docs/" # logical from .rst - -# shields_io_colors = ["success", "important", "critical", "informational", "inactive"] - -if __name__ == "main": - badges = {} - - # one build=passing badge for each python version - for filename in glob.glob(".tox/py*/log/*commands*.log"): - with open(filename, "r") as fp: - status = "passing" - color = "success" - for line in fp: - if line.startswith("name: "): - name = line[6:].strip() - if m := re.search(r"===.*(\d+) failed", line): - failed = int(m.group(1)) - status = "failed" - color = "critical" - badge = requests.get( - f"https://img.shields.io/badge/{name}-{status}-{color}" - ).text - filename = f"_images/tox-{name}.svg" - with open(f"{DESTDIR}{filename}", "w") as dest: - dest.write(badge) - print(f"{filename}") - - badges[name] = f"{REFDIR}{filename}" - - # one coverage badge - with open("htmlcov/index.html") as fp: - root = etree.parse(fp, parser=etree.HTMLParser()).getroot() - - coverage = root.xpath("//span[@class='pc_cov']")[0].text - - cov = int(coverage.rstrip("%")) - if cov > 95: - color = "success" - elif cov > 75: - color = "important" - else: - color = "critical" - - badge = requests.get( - f"https://img.shields.io/badge/coverage-{coverage}-{color}" - ).text - - filename = "_images/coverage.svg" - with open(f"{DESTDIR}{filename}", "w") as dest: - dest.write(badge) - print(f"{filename}") - badges["coverage"] = f"{REFDIR}{filename}" diff --git a/pyproject.toml b/pyproject.toml index f062d5c..38799cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,6 +87,8 @@ skip_missing_interpreters = True [testenv] allowlist_externals = make -deps = pytest +deps = + pytest + requests commands = make BIN= test """ diff --git a/requirements-dev.txt b/requirements-dev.txt index 9ab54f4..c642ff5 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,12 +3,13 @@ blackdoc build coverage[toml] mypy -lxml pydocstyle pylint pytest +requests sphinx sphinx-rtd-theme toml tox +types-requests twine diff --git a/tests/conftest.py b/tests/conftest.py index 631f0f6..094f364 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,6 +2,7 @@ import sys import pytest +import requests from suffix_tree import Tree, util @@ -19,6 +20,7 @@ def tree(): } ) + @pytest.fixture() def debug_dot_mode(): """This fixture turns on debug dot mode.""" @@ -27,33 +29,66 @@ def debug_dot_mode(): util.DEBUG_DOT = False -if sys.version_info >= (3,9): +if sys.version_info >= (3, 9): + class DebugAction(argparse.BooleanOptionalAction): """This action turns on the DEBUG flags so we get coverage of the debug code.""" + def __call__(self, parser, namespace, values, option_string=None): if option_string in self.option_strings: util.DEBUG = True util.DEBUG_LABELS = True - # do not turn on DEBUG_DOT, it would run too slow. we test it in test_dot + # do not turn on DEBUG_DOT, it would run too slow. + # we test it in test_dot + else: + class DebugAction(argparse.Action): """This action turns on the DEBUG flags so we get coverage of the debug code.""" + def __init__(self, option_strings, dest, nargs=None, **kwargs): if nargs is not None: raise ValueError("nargs not allowed") super().__init__(option_strings, dest, **kwargs) + def __call__(self, parser, namespace, values, option_string=None): if option_string in self.option_strings: util.DEBUG = True util.DEBUG_LABELS = True - # do not turn on DEBUG_DOT, it would run too slow. we test it in test_dot - + # do not turn on DEBUG_DOT, it would run too slow. + # we test it in test_dot def pytest_addoption(parser): - parser.addoption( - "--performance", action="store_true", help="run performance tests" - ) + parser.addoption("--performance", action="store_true", help="run performance tests") parser.addoption( "--debug-mode", action=DebugAction, help="turn on DEBUG mode while testing" ) + + +def pytest_sessionfinish(session, exitstatus): + """Hook called after whole test run finished, right before returning + the exit status to the system.""" + + DESTDIR = "docs/" # physical + + if sys.implementation.name == "pypy": + py = "pypy" + else: + py = "py" + if exitstatus == 0: + status = "passing" + color = "success" + else: + status = "failed" + color = "critical" + name = f"{py}{sys.version_info.major}{sys.version_info.minor}" + + badge = requests.get( + f"https://img.shields.io/badge/{name}-{status}-{color}" + ).text + + filename = f"_images/badge-{name}.svg" + with open(f"{DESTDIR}{filename}", "w") as dest: + dest.write(badge) + print(f"{filename}") diff --git a/tests/make_coverage_badge.py b/tests/make_coverage_badge.py new file mode 100755 index 0000000..32a51f5 --- /dev/null +++ b/tests/make_coverage_badge.py @@ -0,0 +1,24 @@ +#!python3 + +import json +import sys + +import requests + +# shields_io_colors = ["success", "important", "critical", "informational", "inactive"] + +if __name__ == "__main__": + j = json.load(sys.stdin) + coverage = j["totals"]["percent_covered_display"] + + cov = int(coverage) + if cov > 95: + color = "success" + elif cov > 75: + color = "important" + else: + color = "critical" + + print(requests.get( + f"https://img.shields.io/badge/coverage-{cov}%-{color}" + ).text)