Skip to content

Instantly share code, notes, and snippets.

@lizrush
Created December 22, 2015 23:54
Show Gist options
  • Save lizrush/c2b019a35fb0dc07d6fa to your computer and use it in GitHub Desktop.
Save lizrush/c2b019a35fb0dc07d6fa to your computer and use it in GitHub Desktop.
Example case of calling another algorithm within an algo -- no auth needed
import Algorithmia
def apply(input):
trigrams = input[0]
beginToken = input[1]
endToken = input[2]
paragraphLength = input[3]
triInput = [trigrams, beginToken, endToken]
result_paragraph = ''
sentenceCount = 0
while sentenceCount < paragraphLength:
result_paragraph += ' '
result_paragraph += Algorithmia.algo("ngram/RandomTextFromTrigram/0.1.1").pipe(triInput)
sentenceCount += 1
return result_paragraph
if 'url' in input:
text = Algorithmia.algo(util/Html2Text/0.1.3').pipe(input['url'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment