Replace hyphenated wordsΒΆ
Example
>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.descriptors import InitializeThesaurus, ReplaceHyphenatedWords
>>> # Redirecting stderr to avoid messages
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Create thesaurus
>>> InitializeThesaurus(root_directory="examples/fintech/", quiet=True).run()
>>> # Configure and run the replacer
>>> replacer = (
... ReplaceHyphenatedWords(tqdm_disable=True, use_colorama=False)
... .where_root_directory_is("examples/fintech/")
... )
>>> replacer.run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Replacing hyphenated words in thesaurus keys...
File : examples/fintech/data/thesaurus/descriptors.the.txt
33 hypenated words transformed successfully
Replacement process completed successfully
Printing thesaurus header
File : examples/fintech/data/thesaurus/descriptors.the.txt
A_FINTECH_ECO_SYSTEM
A_FINTECH_ECOSYSTEM
A_WIDE_RANGING_RE_CONCEPTUALIZATION
A_WIDE_RANGING_RECONCEPTUALIZATION
AGRI_BUSINESS
AGRIBUSINESS
BACK_OFFICE_FUNCTIONS
BACKOFFICE_FUNCTIONS
BLOCK_CHAIN
BLOCKCHAIN
BLOCK_CHAIN_IMPLEMENTATION
BLOCKCHAIN_IMPLEMENTATION
BROADER_AGRICULTURE_ECO_SYSTEM
BROADER_AGRICULTURE_ECOSYSTEM
COMPLEX_GENERATES_DIGITAL_ECO_SYSTEMS
COMPLEX_GENERATES_DIGITAL_ECOSYSTEMS