Apply ThesaurusΒΆ
Example
>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.descriptors import ApplyThesaurus, InitializeThesaurus
>>> # Redirecting stderr to avoid messages
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Create the thesaurus
>>> InitializeThesaurus(root_directory="examples/fintech/", quiet=True).run()
>>> applier = (
... ApplyThesaurus(use_colorama=False)
... .where_root_directory_is("examples/fintech/")
... )
>>> applier.run()
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Applying user thesaurus to database...
File : examples/fintech/data/thesaurus/descriptors.the.txt
Source field : raw_author_keywords
Target field : author_keywords
Application process completed successfully
Applying user thesaurus to database...
File : examples/fintech/data/thesaurus/descriptors.the.txt
Source field : raw_index_keywords
Target field : index_keywords
Application process completed successfully
Applying user thesaurus to database...
File : examples/fintech/data/thesaurus/descriptors.the.txt
Source field : raw_keywords
Target field : keywords
Application process completed successfully
Applying user thesaurus to database...
File : examples/fintech/data/thesaurus/descriptors.the.txt
Source field : raw_document_title_nouns_and_phrases
Target field : document_title_nouns_and_phrases
Application process completed successfully
Applying user thesaurus to database...
File : examples/fintech/data/thesaurus/descriptors.the.txt
Source field : raw_abstract_nouns_and_phrases
Target field : abstract_nouns_and_phrases
Application process completed successfully
Applying user thesaurus to database...
File : examples/fintech/data/thesaurus/descriptors.the.txt
Source field : raw_nouns_and_phrases
Target field : nouns_and_phrases
Application process completed successfully
Applying user thesaurus to database...
File : examples/fintech/data/thesaurus/descriptors.the.txt
Source field : raw_descriptors
Target field : descriptors
Application process completed successfully