Initialize ThesaurusΒΆ

Example

>>> # TEST:
>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.user import InitializeThesaurus
>>> # Redirecting stderr to avoid messages during doctests
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Initialize the thesaurus
>>> initializator = (
...     InitializeThesaurus(use_colorama=False)
...     .with_thesaurus_file("demo.the.txt")
...     .with_field("raw_descriptors")
...     .where_root_directory_is("examples/fintech/")
... )
>>> initializator.run()
>>> # Capture and print stderr output to test the code using doctest
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Initializing thesaurus from 'raw_descriptors' field...
  File : examples/fintech/data/thesaurus/demo.the.txt
  1724 keys found
  Initialization process completed successfully

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

    A_A_THEORY
      A_A_THEORY
    A_BASIC_RANDOM_SAMPLING_STRATEGY
      A_BASIC_RANDOM_SAMPLING_STRATEGY
    A_BEHAVIOURAL_PERSPECTIVE
      A_BEHAVIOURAL_PERSPECTIVE
    A_BETTER_UNDERSTANDING
      A_BETTER_UNDERSTANDING
    A_BLOCKCHAIN_IMPLEMENTATION_STUDY
      A_BLOCKCHAIN_IMPLEMENTATION_STUDY
    A_CASE_STUDY
      A_CASE_STUDY
    A_CHALLENGE
      A_CHALLENGE
    A_CLUSTER_ANALYSIS
      A_CLUSTER_ANALYSIS