Sort by AlphabetΒΆ

Example

>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.descriptors import InitializeThesaurus, SortByAlphabet
>>> # 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 = (
...     SortByAlphabet(use_colorama=False)
...     .where_root_directory_is("examples/fintech/")
... )
>>> sorter.run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = StringIO()
>>> print(output) 
Sorting thesaurus alphabetically...
  File : examples/fintech/data/thesaurus/descriptors.the.txt
  Sorting process completed successfully

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

    ABOUT_ONE_THIRD
      ABOUT_ONE_THIRD
    ACADEMIA
      ACADEMIA
    ACADEMICS
      ACADEMICS
    ACADEMIC_OBSERVERS
      ACADEMIC_OBSERVERS
    ACADEMIC_RESEARCH
      ACADEMIC_RESEARCH
    ACCELERATE_ACCESS
      ACCELERATE_ACCESS
    ACCESS
      ACCESS
    ACCESS_LOANS
      ACCESS_LOANS