Sort by Last WordsΒΆ

Example

>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.descriptors import InitializeThesaurus, SortByLastWords
>>> # Redirecting stderr to avoid messages
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Create the thesaurus
>>> InitializeThesaurus(root_directory="examples/fintech/", quiet=True).run()
>>> # Configure and run the sorter
>>> sorter = (
...     SortByLastWords(use_colorama=False)
...     .where_root_directory_is("examples/fintech/")
... )
>>> sorter.run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Sorting thesaurus by common last words...
  File : examples/fintech/data/thesaurus/descriptors.the.txt
  17 matching keys found
  Sorting process completed successfully

Printing thesaurus header
  File : examples/fintech/data/thesaurus/descriptors.the.txt

    AGRICULTURE_PLAYS
      AGRICULTURE_PLAYS
    CHINA_EASTERN
      CHINA_EASTERN
    CONTINUANCE_INTENTION_DIFFERS
      CONTINUANCE_INTENTION_DIFFERS
    DIGITAL_FINANCE_ENCOMPASSES
      DIGITAL_FINANCE_ENCOMPASSES
    ENTREPRENEURIAL_ENDEAVOURS
      ENTREPRENEURIAL_ENDEAVOURS
    FOUR_SPECIFIC_INCREASES
      FOUR_SPECIFIC_INCREASES
    INNOVATIONS_EXACERBATE
      INNOVATIONS_EXACERBATE
    LENDINGCLUB_LOANS_INCREASES
      LENDINGCLUB_LOANS_INCREASES