Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator template question #51

Closed
matthewchung74 opened this issue Sep 1, 2022 · 2 comments
Closed

Generator template question #51

matthewchung74 opened this issue Sep 1, 2022 · 2 comments

Comments

@matthewchung74
Copy link

Is there an example showing how to make a provider that maps to a string for replacement in a template?

For example, if I have a snippet like this

class HospitalProvider(BaseProvider):
    def __init__(
        self,
        generator,
    ):
        super().__init__(generator=generator)
        self.hospital_name = "My Test Hospital"

fake = RecordsFaker(records = pd.DataFrame() ,locale="en_US")

sentence_templates = [
    "My name is {{HOSPITAL}}",
    ]

fake.add_provider(HospitalProvider)

How do I tell the generator to replace all strings {{HOSPITAL}} with , in this case, My Test Hospital?

@omri374
Copy link
Contributor

omri374 commented Sep 4, 2022

@matthewchung74
Copy link
Author

Yes it does. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants