Translate American to British SpellingΒΆ
Example
>>> # Redirecting stderr to avoid messages during doctests
>>> import sys
>>> from io import StringIO
>>> original_stderr = sys.stderr
>>> sys.stderr = StringIO()
>>> # Reset the thesaurus to initial state
>>> from techminer2.thesaurus.user import InitializeThesaurus
>>> InitializeThesaurus(thesaurus_file="demo.the.txt", field="raw_descriptors",
... root_directory="examples/fintech/", quiet=True).run()
>>> # Creates, configures, an run the translator
>>> from techminer2.thesaurus.user import AmericanToBritishSpelling
>>> (
... AmericanToBritishSpelling(tqdm_disable=True, use_colorama=False)
... .with_thesaurus_file("demo.the.txt")
... .where_root_directory_is("examples/fintech/")
... .run()
... )
>>> # Capture and print stderr output to test the code using doctest
>>> output = sys.stderr.getvalue()
>>> sys.stderr = original_stderr
>>> print(output)
Converting American to British English...
File : examples/fintech/data/thesaurus/demo.the.txt
21 replacements made successfully
Translation process completed successfully
Printing thesaurus header
File : examples/fintech/data/thesaurus/demo.the.txt
A_COMPLETE_GENERALISATION
A_COMPLETE_GENERALIZATION
AN_ORGANISATION
AN_ORGANIZATION
BEHAVIOURAL_BIASES
BEHAVIORAL_BIASES
CATEGORISES_RESEARCH
CATEGORIZES_RESEARCH
CHARACTERISE_FINTECH
CHARACTERIZE_FINTECH
DECENTRALISED_FINTECH_MARKETS
DECENTRALIZED_FINTECH_MARKETS
DIGITISED_AGRICULTURE
DIGITIZED_AGRICULTURE
EXCESSIVELY_RISKY_BEHAVIOUR
EXCESSIVELY_RISKY_BEHAVIOR