IDEA: replace abbreviations with their meaning.
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.
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
This would be a great feature
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
Show your dict
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.
The Abbreviations dict A dict is a dictionary
The Abbreviations dict A dict is a dictionary
Abbreviations = {"test": "just testing"}
The Abbreviations dict A dict is a dictionary
oh and, Abbreviations have to be defined before adding the "newtext" line right?
Yes
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
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!
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?
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
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!!
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?
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?
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.
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.
wont implement