def processFactTemplate(txt): factProcessor.processFactEarly(txt) txt = txt.replace("!LUCKYNUMBER!", str(getRealisticLuckyNumber())) # Use a representativeExpression matchKeys = re.compile(r'\[({})\]'.format('|'.join(words))) txt = matchKeys.sub(lambda match: random.choice(words[match.group(1)]), str(txt)) if random.random() < 0.1: addSuffix(txt) return txt
def processFactTemplate(txt): txt = factProcessor.processFactEarly(txt) # Use a charmExpression matchKeys = re.compile(r'\[({})\]'.format('|'.join(words))) txt = matchKeys.sub(lambda match: random.choice(words[match.group(1)]), str(txt)) if random.random() < 0.1: addPrefix(txt) return txt
def processFactTemplate(txt): txt = factProcessor.processFactEarly(txt) if random.random() < 0.4: txt = txt.replace("[idol]", random.choice(words["otherIdol"])) if random.random() < 0.7: txt += random.choice(words["suffix"]) txt = basicUtils.processFactTemplateBasic(txt, words) return txt
def processFactTemplate(txt): txt = factProcessor.processFactEarly(txt) pickHabit = random.choice(words["habiting"]) if random.random() < 0.1: pickHabit += random.choice(words["habitSuffix"]) txt = txt.replace("[habiting]", pickHabit) if random.random() < 0.1: txt += ". " + random.choice(words["suffix"]) # Substitute all [] words matchKeys = re.compile(r'\[({})\]'.format('|'.join(words))) txt = matchKeys.sub(lambda match: random.choice(words[match.group(1)]), txt) return txt
def processFactTemplate(txt, gender): txt = factProcessor.processFactEarly(txt) txt = txt.replace("[EnglishName]", random.choice(englishNamesM if gender else englishNamesF)) return txt
def processFactTemplate(txt): txt = factProcessor.processFactEarly(txt) # Substitute all [] words matchKeys = re.compile(r'\[({})\]'.format('|'.join(words))) txt = matchKeys.sub(lambda match: random.choice(words[match.group(1)]), txt) return txt