Parentheses RemoverΒΆ

Example

>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.descriptors import CreateThesaurus, RemoveParentheses
>>> # Redirecting stderr to avoid messages
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Create the thesaurus
>>> CreateThesaurus(root_directory="example/", quiet=True).run()
>>> # Remove parentheses
>>> RemoveParentheses(root_directory="example/").run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Removing parentheses from thesaurus keys

  File : example/thesaurus/descriptors.the.txt
  7 removals made successfully
  Parentheses removal completed successfully

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

    CACIOPPO
      CACIOPPO_[1]
    CLASSIFICATION
      CLASSIFICATION (OF_INFORMATION)
    COMPETITION
      COMPETITION; COMPETITION (ECONOMICS)
    FINANCIAL_TECHNOLOGY
      FINANCIAL_TECHNOLOGIES; FINANCIAL_TECHNOLOGY; FINANCIAL_TECHNOLOGY (FINTECH)
    INTERNET_OF_THING
      INTERNET_OF_THING (IOT); INTERNET_OF_THINGS
    NETWORKS
      NETWORKS; NETWORKS (CIRCUITS)
    PRESSES
      PRESSES (MACHINE_TOOLS)
    A_A_)_THEORY
      A_A_)_THEORY