Sort by Key OrderΒΆ
Example
>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.descriptors import CreateThesaurus, SortByKeyOrder
>>> # Redirecting stderr to avoid messages
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Create the thesaurus
>>> CreateThesaurus(root_directory="example/", quiet=True).run()
>>> # Configure and run the sorter
>>> sorter = (
... SortByKeyOrder()
... .having_keys_ordered_by("alphabetical")
... .where_root_directory_is("example/")
... )
>>> sorter.run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = StringIO()
>>> print(output)
Reducing thesaurus keys
File : example/thesaurus/descriptors.the.txt
Keys reduced from 1729 to 1729
Keys reduction completed successfully
Sorting thesaurus alphabetically
File : example/thesaurus/descriptors.the.txt
Thesaurus sorting completed successfully
Printing thesaurus header
File : example/thesaurus/descriptors.the.txt
ACADEMIA
ACADEMIA
ACADEMICS
ACADEMICS
ACADEMIC_OBSERVERS
ACADEMIC_OBSERVERS
ACADEMIC_RESEARCH
ACADEMIC_RESEARCH
ACCELERATE_ACCESS
ACCELERATE_ACCESS
ACCEPTANCE_MODELS
ACCEPTANCE_MODELS
ACCESS
ACCESS
ACCESS_LOANS
ACCESS_LOANS
>>> # Configure and run the sorter
>>> sorter = (
... SortByKeyOrder()
... .having_keys_ordered_by("key_length")
... .where_root_directory_is("example/")
... )
>>> sorter.run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = StringIO()
>>> print(output)
Reducing thesaurus keys
File : example/thesaurus/descriptors.the.txt
Keys reduced from 1729 to 1729
Keys reduction completed successfully
Sorting thesaurus by key length
File : example/thesaurus/descriptors.the.txt
Thesaurus sorting completed successfully
Printing thesaurus header
File : example/thesaurus/descriptors.the.txt
CONTINUOUS_INTENTION_TO_USE_MOBILE_FINTECH_PAYMENT_SERVICES
CONTINUOUS_INTENTION_TO_USE_MOBILE_FINTECH_PAYMENT_SERVICES
UNIFIED_THEORY_OF_ACCEPTANCE_AND_USE_OF_TECHNOLOGY_MODEL
UNIFIED_THEORY_OF_ACCEPTANCE_AND_USE_OF_TECHNOLOGY_MODEL
A_NOVEL_HYBRID_MULTIPLE_CRITERIA_DECISION_MAKING_METHOD
A_NOVEL_HYBRID_MULTIPLE_CRITERIA_DECISION_MAKING_METHOD
THE_MOST_IMPORTANT_AND_FASTEST_GROWING_FINTECH_SERVICES
THE_MOST_IMPORTANT_AND_FASTEST_GROWING_FINTECH_SERVICES
INSTITUTIONS_OVERLOOKS_THE_CONCEPTUALLY_DISTINCT_RISKS
INSTITUTIONS_OVERLOOKS_THE_CONCEPTUALLY_DISTINCT_RISKS
THE_HEFEI_SCIENCE_AND_TECHNOLOGY_RURAL_COMMERCIAL_BANK
THE_HEFEI_SCIENCE_AND_TECHNOLOGY_RURAL_COMMERCIAL_BANK
FUTURE_AND_PRESENT_MOBILE_FINTECH_PAYMENT_SERVICES
FUTURE_AND_PRESENT_MOBILE_FINTECH_PAYMENT_SERVICES
UNIFIED_THEORY_OF_ACCEPTANCE_AND_USE_OF_TECHNOLOGY
UNIFIED_THEORY_OF_ACCEPTANCE_AND_USE_OF_TECHNOLOGY
>>> # Configure and run the sorter
>>> sorter = (
... SortByKeyOrder()
... .having_keys_ordered_by("word_length")
... .where_root_directory_is("example/")
... )
>>> sorter.run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Reducing thesaurus keys
File : example/thesaurus/descriptors.the.txt
Keys reduced from 1729 to 1729
Keys reduction completed successfully
Sorting thesaurus by word length
File : example/thesaurus/descriptors.the.txt
Thesaurus sorting completed successfully
Printing thesaurus header
File : example/thesaurus/descriptors.the.txt
RESEARCH_LIMITATIONS/IMPLICATIONS
RESEARCH_LIMITATIONS/IMPLICATIONS
COMPETITION (ECONOMICS)
COMPETITION (ECONOMICS)
FINANCIAL_TECHNOLOGY (FINTECH)
FINANCIAL_TECHNOLOGY (FINTECH)
A_WIDE_RANGING_RECONCEPTUALIZATION
A_WIDE_RANGING_RECONCEPTUALIZATION
NETWORKS (CIRCUITS)
NETWORKS (CIRCUITS)
THE_RECONCEPTUALIZATION
THE_RECONCEPTUALIZATION
CLASSIFICATION (OF_INFORMATION)
CLASSIFICATION (OF_INFORMATION)
EXPLORE_INTERRELATIONSHIPS
EXPLORE_INTERRELATIONSHIPS