aleph23 / prompt-r-gen-sd

generate random prompts for stable diffusion (randomly generate StableDiffusion prompt words)
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

update get tags #5

Closed aleph23 closed 2 months ago

aleph23 commented 2 months ago

Summary by Sourcery

Update the regular expression used for extracting tags to correctly handle spaces around tags, ensuring accurate tag extraction and counting.

Bug Fixes:

sourcery-ai[bot] commented 2 months ago

Reviewer's Guide by Sourcery

This pull request updates the regular expression used for extracting tags in the handle_train_tag function. The change aims to improve the tag extraction process by allowing for more flexible tag formats, including tags with spaces.

File-Level Changes

Change Details Files
Modified the regular expression for tag extraction
  • Updated regex pattern from r'\b([^\s,]+)\b' to r'\s([^,]+?)\s(?=,
$)'
  • New regex allows for tags with spaces and trims whitespace
  • Improved handling of tags at the end of the string
  • promptsModules/train_tags.py

    Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.