Sort by Word MatchΒΆ
Example
>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.system.descriptors import SortByWordMatch
>>> # Redirecting stderr to avoid messages
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Configure and run the sorter
>>> (
... SortByWordMatch(use_colorama=False)
... .having_pattern("CREDIT")
... .run()
... )
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Sorting thesaurus by word match...
File : ...techminer2/package_data/thesaurus/system/descriptors.the.txt
Word : CREDIT
0 matching keys found
Sorting process completed successfully
Printing thesaurus header
File : /Volumes/GitHub/techminer2/techminer2/package_data/thesaurus/system/descriptors.the.txt
ANALYSIS
ANALYZES
APPLICATION
APPLICATIONS
APPROACH
APPROACHES
ARTICLE
ARTICLES
ARTIFICIAL_NEURAL_NETWORK
ARTIFICIAL_NEURAL_NETWORKS; ARTIFICIAL_NEURAL_NETWORK_MODEL; ARTIFICIAL_N...
AUTHOR
AUTHORS
BIBLIOMETRICS
BIBLIOMETRIC
BLOCK_CHAIN
BLOCK_CHAINS; BLOCKCHAIN; BLOCKCHAINS