Replace AbbreviationsΒΆ

Example

>>> import shutil
>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.descriptors import InitializeThesaurus, ReplaceAbbreviations
>>> # Redirecting stderr to avoid messages
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Copy the abbreviations file
>>> shutil.copy("examples/fintech/abbreviations.the.txt", "examples/fintech/data/thesaurus/abbreviations.the.txt")
'examples/fintech/data/thesaurus/abbreviations.the.txt'
>>> # Create thesaurus
>>> InitializeThesaurus(root_directory="examples/fintech/", quiet=True).run()
>>> # Configure and run the replacer
>>> replacer = ReplaceAbbreviations(root_directory="examples/fintech/", tqdm_disable=True, use_colorama=False)
>>> replacer.run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)  
Replacing abbreviations in keys...
      Thesaurus : ...h/data/thesaurus/descriptors.the.txt
  Abbreviations : ...data/thesaurus/abbreviations.the.txt
  120 replacements made successfully
  Replacement process completed successfully

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

    A_EUROPEAN_OR_NATIONAL_FINANCIAL_TECHNOLOGY_MARKET
      A_EUROPEAN_OR_NATIONAL_FINTECH_MARKET
    A_FINANCIAL_TECHNOLOGY_COMPANY
      A_FINTECH_COMPANY
    A_FINANCIAL_TECHNOLOGY_ECOSYSTEM
      A_FINTECH_ECOSYSTEM
    A_HYBRID_MULTI_CRITERIA_DECISION_MAKING_METHOD_MODEL
      A_HYBRID_MCDM_MODEL
    A_NEW_FINANCIAL_TECHNOLOGY_INNOVATION_MAPPING_APPROACH
      A_NEW_FINTECH_INNOVATION_MAPPING_APPROACH
    A_THEORETICAL_DATA_DRIVEN_FINANCIAL_TECHNOLOGY_FRAMEWORK
      A_THEORETICAL_DATA_DRIVEN_FINTECH_FRAMEWORK
    ACTIVE_FINANCIAL_TECHNOLOGY_SOLUTIONS
      ACTIVE_FINTECH_SOLUTIONS
    ACTOR_NETWORK_THEORY
      ACTOR_NETWORK_THEORY; ANT