Created
December 22, 2015 23:54
-
-
Save lizrush/c2b019a35fb0dc07d6fa to your computer and use it in GitHub Desktop.
Example case of calling another algorithm within an algo -- no auth needed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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