mirror of https://gitlab.com/bashrc2/epicyon
Fix unit tests
parent
50ec0f6ce2
commit
76314d55b6
54
speaker.py
54
speaker.py
|
@ -68,27 +68,29 @@ def _speakerPronounce(baseDir: str, sayText: str, translate: {}) -> str:
|
||||||
Epicyon -> Epi-cyon
|
Epicyon -> Epi-cyon
|
||||||
"""
|
"""
|
||||||
pronounceFilename = baseDir + '/accounts/speaker_pronounce.txt'
|
pronounceFilename = baseDir + '/accounts/speaker_pronounce.txt'
|
||||||
convertDict = {
|
convertDict = {}
|
||||||
"Epicyon": "Epi-cyon",
|
if translate:
|
||||||
"espeak": "e-speak",
|
convertDict = {
|
||||||
"emoji": "emowji",
|
"Epicyon": "Epi-cyon",
|
||||||
"clearnet": "clear-net",
|
"espeak": "e-speak",
|
||||||
"https": "H-T-T-P-S",
|
"emoji": "emowji",
|
||||||
"HTTPS": "H-T-T-P-S",
|
"clearnet": "clear-net",
|
||||||
"Tor": "Toor",
|
"https": "H-T-T-P-S",
|
||||||
"🤔": ". " + translate["thinking emoji"],
|
"HTTPS": "H-T-T-P-S",
|
||||||
"RT @": "Re-Tweet ",
|
"Tor": "Toor",
|
||||||
"#": translate["hashtag"],
|
"🤔": ". " + translate["thinking emoji"],
|
||||||
":D": '. ' + translate["laughing"],
|
"RT @": "Re-Tweet ",
|
||||||
":-D": '. ' + translate["laughing"],
|
"#": translate["hashtag"],
|
||||||
":)": '. ' + translate["smile"],
|
":D": '. ' + translate["laughing"],
|
||||||
";)": '. ' + translate["wink"],
|
":-D": '. ' + translate["laughing"],
|
||||||
":(": '. ' + translate["sad face"],
|
":)": '. ' + translate["smile"],
|
||||||
":-)": '. ' + translate["smile"],
|
";)": '. ' + translate["wink"],
|
||||||
":-(": '. ' + translate["sad face"],
|
":(": '. ' + translate["sad face"],
|
||||||
";-)": '. ' + translate["wink"],
|
":-)": '. ' + translate["smile"],
|
||||||
"*": ""
|
":-(": '. ' + translate["sad face"],
|
||||||
}
|
";-)": '. ' + translate["wink"],
|
||||||
|
"*": ""
|
||||||
|
}
|
||||||
if os.path.isfile(pronounceFilename):
|
if os.path.isfile(pronounceFilename):
|
||||||
with open(pronounceFilename, 'r') as fp:
|
with open(pronounceFilename, 'r') as fp:
|
||||||
pronounceList = fp.readlines()
|
pronounceList = fp.readlines()
|
||||||
|
@ -124,7 +126,10 @@ def speakerReplaceLinks(sayText: str, translate: {},
|
||||||
text = text.replace(ch, ' ')
|
text = text.replace(ch, ' ')
|
||||||
replacements = {}
|
replacements = {}
|
||||||
wordsList = text.split(' ')
|
wordsList = text.split(' ')
|
||||||
linkedStr = translate['Linked']
|
if translate.get('Linked'):
|
||||||
|
linkedStr = translate['Linked']
|
||||||
|
else:
|
||||||
|
linkedStr = 'Linked'
|
||||||
prevWord = ''
|
prevWord = ''
|
||||||
for word in wordsList:
|
for word in wordsList:
|
||||||
if word.startswith(':'):
|
if word.startswith(':'):
|
||||||
|
@ -133,8 +138,9 @@ def speakerReplaceLinks(sayText: str, translate: {},
|
||||||
continue
|
continue
|
||||||
# replace mentions, but not re-tweets
|
# replace mentions, but not re-tweets
|
||||||
if word.startswith('@') and not prevWord.endswith('RT'):
|
if word.startswith('@') and not prevWord.endswith('RT'):
|
||||||
replacements[word] = \
|
if translate.get('mentioning'):
|
||||||
translate['mentioning'] + ' ' + word[1:] + ','
|
replacements[word] = \
|
||||||
|
translate['mentioning'] + ' ' + word[1:] + ','
|
||||||
prevWord = word
|
prevWord = word
|
||||||
|
|
||||||
domain = None
|
domain = None
|
||||||
|
|
5
utils.py
5
utils.py
|
@ -678,7 +678,10 @@ def getGenderFromBio(baseDir: str, actor: str, personCache: {},
|
||||||
if not personCache.get(actor):
|
if not personCache.get(actor):
|
||||||
return None
|
return None
|
||||||
bioFound = None
|
bioFound = None
|
||||||
pronounStr = translate['pronoun'].lower()
|
if translate:
|
||||||
|
pronounStr = translate['pronoun'].lower()
|
||||||
|
else:
|
||||||
|
pronounStr = 'pronoun'
|
||||||
if personCache[actor].get('actor'):
|
if personCache[actor].get('actor'):
|
||||||
# is gender defined as a profile tag?
|
# is gender defined as a profile tag?
|
||||||
if personCache[actor]['actor'].get('attachment'):
|
if personCache[actor]['actor'].get('attachment'):
|
||||||
|
|
Loading…
Reference in New Issue