This file contains hidden or 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 nltk | |
| import gensim | |
| text = requests.get('http://rare-technologies.com/the_matrix_synopsis.txt').text | |
| gensim_summary = gensim.summarization.summarize(text) |
This file contains hidden or 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
| """ | |
| First install text_summarizer using | |
| pip install git+https://github.com/lambdaofgod/text-summarizer | |
| """ | |
| import nltk | |
| import text_summarizer | |
| # prepare nltk data | |
| nltk.download('punkt') |
This file contains hidden or 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
| def handler(event, context): | |
| task_token = event['task_token'] | |
| error_info = event['error_info'] | |
| states_client.send_task_failure( | |
| taskToken=task_token, | |
| error=error_info['Error'], | |
| cause=error_info.get('Cause', 'Cause is undefined.'), | |
| ) |
This file contains hidden or 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
| def handler(event, context): | |
| task_token = event['task_token'] | |
| output_state = event['state'][0] | |
| states_client.send_task_success( | |
| taskToken=task_token, | |
| output=json.dumps(output_state), | |
| ) | |
| return event |
This file contains hidden or 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
| def async_invoke_handler(event, context): | |
| activity_task_response = states_client.get_activity_task( | |
| activityArn=ASYNC_ACTION_ACTIVITY_ARN, | |
| workerName=context.function_name, | |
| ) | |
| if 'taskToken' not in activity_task_response: | |
| raise MissingScheduledActivityTaskException() | |
| input_for_nested_execution = { |