Replace hyphenated wordsΒΆ

Example

>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.descriptors import CreateThesaurus, ReplaceHyphenatedWords
>>> # Redirecting stderr to avoid messages
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Create thesaurus
>>> CreateThesaurus(root_directory="example/", quiet=True).run()
>>> # Configure and run the replacer
>>> replacer = (
...     ReplaceHyphenatedWords(tqdm_disable=True)
...     .where_root_directory_is("example/")
... )
>>> replacer.run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Transforming hyphenated words in thesaurus keys
  File : example/thesaurus/descriptors.the.txt
  51 hypenated words transformed successfully
  Hyphenated words transformation completed successfully

Printing thesaurus header
  File : example/thesaurus/descriptors.the.txt

    A_FINTECH_ECO_SYSTEM
      A_FINTECH_ECOSYSTEM
    A_WIDE_RANGING_RE_CONCEPTUALIZATION
      A_WIDE_RANGING_RECONCEPTUALIZATION
    AGRI_BUSINESS
      AGRIBUSINESS
    AGRO_INDUSTRY
      AGROINDUSTRY
    BACK_OFFICE_FUNCTIONS
      BACKOFFICE_FUNCTIONS
    BLOCK_CHAIN
      BLOCKCHAIN; BLOCKCHAINS
    BLOCK_CHAIN_AND_FINTECH_INNOVATIONS
      BLOCKCHAIN_AND_FINTECH_INNOVATIONS
    BLOCK_CHAIN_ENABLES
      BLOCKCHAIN_ENABLES