RedditVideoMakerBot icon indicating copy to clipboard operation
RedditVideoMakerBot copied to clipboard

IDEA: replace abbreviations with their meaning.

Open mlvps opened this issue 4 years ago • 19 comments

for example replace "tifu" from r/tifu with: today I fcked up. Is there a way to do that? I would like to replace some abbreviations in the code.

mlvps avatar Jun 09 '22 16:06 mlvps

this will 99% not be implemented but you could implement it via this. newtext = ' '.join(Abbreviations.get(i.upper()) for i in text) with Abbreviations being a dict like this. Abbreviations = {'Abbreviations': 'FULL TEXT', 'didn't': 'did not'} and text being the comments text

JasonLovesDoggo avatar Jun 09 '22 16:06 JasonLovesDoggo

This would be a great feature

DrMxrcy avatar Jun 09 '22 17:06 DrMxrcy

newtext = ' '.join(Abbreviations.get(i.upper()) for i in text)

I get this error message: Traceback (most recent call last): File "C:\Users\User\Desktop\Reddit Bot\main.py", line 50, in main() File "C:\Users\User\Desktop\Reddit Bot\main.py", line 41, in main length, number_of_comments = save_text_to_mp3(reddit_object, os.getenv("VOICE")) File "C:\Users\User\Desktop\Reddit Bot\video_creation\voices.py", line 61, in save_text_to_mp3 newtext = ' '.join(Abbreviations.get(i.upper()) for i in thread_title) TypeError: sequence item 0: expected str instance, NoneType found

mlvps avatar Jun 09 '22 17:06 mlvps

Show your dict

JasonLovesDoggo avatar Jun 09 '22 18:06 JasonLovesDoggo

i´m sorry I dont know what a dict is, but most of the code is from your fork, I just use another tts voice and changed some stuff/ fixed some bugs i had.

mlvps avatar Jun 09 '22 18:06 mlvps

The Abbreviations dict A dict is a dictionary

JasonLovesDoggo avatar Jun 09 '22 18:06 JasonLovesDoggo

The Abbreviations dict A dict is a dictionary

Abbreviations = {"test": "just testing"}

mlvps avatar Jun 09 '22 18:06 mlvps

The Abbreviations dict A dict is a dictionary

oh and, Abbreviations have to be defined before adding the "newtext" line right?

mlvps avatar Jun 09 '22 19:06 mlvps

Yes

JasonLovesDoggo avatar Jun 09 '22 19:06 JasonLovesDoggo

newtext = ' '.join(Abbreviations.get(i.upper()) for i in text)

I get this error message: Traceback (most recent call last): File "C:\Users\User\Desktop\Reddit Bot\main.py", line 50, in main() File "C:\Users\User\Desktop\Reddit Bot\main.py", line 41, in main length, number_of_comments = save_text_to_mp3(reddit_object, os.getenv("VOICE")) File "C:\Users\User\Desktop\Reddit Bot\video_creation\voices.py", line 61, in save_text_to_mp3 newtext = ' '.join(Abbreviations.get(i.upper()) for i in thread_title) TypeError: sequence item 0: expected str instance, NoneType found

That just means that it wasn't found. I.e. The abbreviation isn't there I'll fix it for you in 10 minutes

JasonLovesDoggo avatar Jun 09 '22 19:06 JasonLovesDoggo

newtext = ' '.join(Abbreviations.get(i.upper()) for i in text)

I get this error message: Traceback (most recent call last): File "C:\Users\User\Desktop\Reddit Bot\main.py", line 50, in main() File "C:\Users\User\Desktop\Reddit Bot\main.py", line 41, in main length, number_of_comments = save_text_to_mp3(reddit_object, os.getenv("VOICE")) File "C:\Users\User\Desktop\Reddit Bot\video_creation\voices.py", line 61, in save_text_to_mp3 newtext = ' '.join(Abbreviations.get(i.upper()) for i in thread_title) TypeError: sequence item 0: expected str instance, NoneType found

That just means that it wasn't found. I.e. The abbreviation isn't there I'll fix it for you in 10 minutes

thanks!

mlvps avatar Jun 09 '22 20:06 mlvps

newtext = ' '.join(Abbreviations.get(i.upper()) for i in text)

I get this error message: Traceback (most recent call last): File "C:\Users\User\Desktop\Reddit Bot\main.py", line 50, in main() File "C:\Users\User\Desktop\Reddit Bot\main.py", line 41, in main length, number_of_comments = save_text_to_mp3(reddit_object, os.getenv("VOICE")) File "C:\Users\User\Desktop\Reddit Bot\video_creation\voices.py", line 61, in save_text_to_mp3 newtext = ' '.join(Abbreviations.get(i.upper()) for i in thread_title) TypeError: sequence item 0: expected str instance, NoneType found

That just means that it wasn't found. I.e. The abbreviation isn't there I'll fix it for you in 10 minutes

did you find a fix?

mlvps avatar Jun 12 '22 20:06 mlvps

Unfortunately in the time past then I cut my finger in half so no but it's pretty simple Change it from a join command to a for loop with try and except

Or if you want to keep it to a one-liner just out of check to see if it exists in the dict before replacing

JasonLovesDoggo avatar Jun 12 '22 20:06 JasonLovesDoggo

Unfortunately in the time past then I cut my finger in half so no but it's pretty simple Change it from a join command to a for loop with try and except

Or if you want to keep it to a one-liner just out of check to see if it exists in the dict before replacing

I´m sorry, I have no idea how that works. Thanks for your help tho!!

mlvps avatar Jun 13 '22 19:06 mlvps

Unfortunately in the time past then I cut my finger in half so no but it's pretty simple Change it from a join command to a for loop with try and except Or if you want to keep it to a one-liner just out of check to see if it exists in the dict before replacing

I´m sorry, I have no idea how that works. Thanks for your help tho!!

does anyone know how that works?

mlvps avatar Jun 14 '22 15:06 mlvps

Unfortunately in the time past then I cut my finger in half so no but it's pretty simple Change it from a join command to a for loop with try and except Or if you want to keep it to a one-liner just out of check to see if it exists in the dict before replacing

I´m sorry, I have no idea how that works. Thanks for your help tho!!

does anyone know how that works?

Please specify what exactly do you want to know how it works?

JasonLovesDoggo avatar Jun 14 '22 16:06 JasonLovesDoggo

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment, or this will be closed in 10 days.

github-actions[bot] avatar Jul 02 '22 00:07 github-actions[bot]

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment, or this will be closed in 10 days.

github-actions[bot] avatar Jul 08 '22 03:07 github-actions[bot]

wont implement

JasonLovesDoggo avatar Jul 12 '22 00:07 JasonLovesDoggo