Apply ThesaurusΒΆ

Example

>>> import sys
>>> from io import StringIO
>>> from techminer2.thesaurus.organizations import ApplyThesaurus, CreateThesaurus
>>> # Redirecting stderr to avoid messages
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Create thesaurus
>>> CreateThesaurus(root_directory="example/", quiet=True).run()
>>> (
...     ApplyThesaurus()
...     #
...     # DATABASE:
...     .where_root_directory_is("example/")
...     #
...     .run()
... )
>>> # Capture and print stderr output
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Applying user thesaurus to database
          File : example/thesaurus/organizations.the.txt
  Source field : affiliations
  Target field : organizations
  Thesaurus application completed successfully