Common Ending Words RemoverΒΆ

Example

>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.descriptors import CreateThesaurus, RemoveCommonLastWords
>>> # Redirecting stderr to avoid messages
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Create the thesaurus
>>> CreateThesaurus(root_directory="example/", quiet=True).run()
>>> # Remove common last words
>>> RemoveCommonLastWords(root_directory="example/", tqdm_disable=True).run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Removing common last words from thesaurus keys
  File : example/data/thesaurus/descriptors.the.txt


  12 ending words removed successfully
  Common last words removal completed successfully

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

    AGRICULTURE
      AGRICULTURE; AGRICULTURE_PLAYS
    CONTINUANCE_INTENTION
      CONTINUANCE_INTENTION; CONTINUANCE_INTENTIONS; CONTINUANCE_INTENTION_DIFFERS
    ENTREPRENEURIAL
      ENTREPRENEURIAL_ENDEAVOURS
    FOUR_SPECIFIC
      FOUR_SPECIFIC_INCREASES
    LENDINGCLUB_LOANS
      LENDINGCLUB_LOANS_INCREASES
    POSITIVE_RELATIONSHIP
      POSITIVE_RELATIONSHIP_EXISTS
    RESIDENTIAL_MORTGAGE
      RESIDENTIAL_MORTGAGE_ORIGINATION
    TAXONOMY
      TAXONOMY; TAXONOMY_CONTRIBUTES