feat: add sum function

This commit is contained in:
max_richter 2021-06-15 14:03:42 +02:00
parent c7f0923ced
commit e42c80e553
3 changed files with 31 additions and 1 deletions

View File

@ -26,6 +26,9 @@ Plug 'evanleck/vim-svelte', {'branch': 'main'}
Plug 'mattn/emmet-vim'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
" Display IMages in Vim
Plug 'ashisha/image.vim'
" Svelte support
Plug 'leafOfTree/vim-svelte-plugin'
@ -73,6 +76,10 @@ nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
nnoremap H gT
nnoremap L gt
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
" Close all open buffers on entering a window if the only

View File

@ -4,5 +4,6 @@ source $(dirname "$0")/functions/start.zsh;
source $(dirname "$0")/functions/wp.zsh;
source $(dirname "$0")/functions/y.zsh;
source $(dirname "$0")/functions/fp.zsh;
source $(dirname "$0")/functions/rn.zsh;
source $(dirname "$0")/functions/sum.zsh;
source $(dirname "$0")/functions/mke.zsh;
source $(dirname "$0")/functions/rn.zsh;

View File

@ -0,0 +1,22 @@
function sum(){
URL=$1
#echo "URL: $URL";
TEXT=$(lynx -notitle -nonumbers -trim_input_fields -nobrowse -hiddenlinks=ignore --dump $URL | xargs | sed -e 's!http\(s\)\{0,1\}://[^[:space:]]*!!g' | sed -e 's/\[[^][]*\]//g')
DEEP_API_KEY="a2de657c-75d0-4a7c-acdf-3b886f860282"
#echo "--------------------";
#echo $TEXT
#echo "--------------------";
RESULT_JSON=$(curl --silent -F "text=$TEXT" -H "api-key:$DEEP_API_KEY" https://api.deepai.org/api/summarization )
#echo "JSON: $RESULT_JSON"
RESULT=$(echo $RESULT_JSON | tr '\r\n' ' ' | jq ".output")
echo $RESULT
}