Skip to content

Instantly share code, notes, and snippets.

@amrrs
amrrs / app.r
Created November 21, 2017 08:04
How to upload and embed pdf in R shiny (iframe)
library(shiny)
ui <- shinyUI(fluidPage(
titlePanel("Testing File upload"),
sidebarLayout(
sidebarPanel(
fileInput('file_input', 'upload file ( . pdf format only)', accept = c('.pdf'))
),
@amrrs
amrrs / find_emoji.r
Created October 27, 2017 12:06 — forked from hrbrmstr/find_emoji.r
find and extract emoji in R
# save this to '_chat.txt` (it require a login)
# https://www.kaggle.com/sarthaknautiyal/whatsappsample
library(ore)
library(dplyr)
emoji_src <- "https://raw.githubusercontent.com/laurenancona/twimoji/gh-pages/twitterEmojiProject/emoticon_conversion_noGraphic.csv"
emoji_fil <- basename(emoji_src)
if (!file.exists(emoji_fil)) download.file(emoji_src, emoji_fil)
@amrrs
amrrs / crptocurrency_marketcap_share.r
Created October 9, 2017 11:03
Draw a Tree Map of Cryptocurrency Marketcap share
library(coinmarketcapr)
library(treemap)
df <- get_marketcap_ticker_all()
df1 <- na.omit(df[,c('id','market_cap_usd')])
df1$market_cap_usd <- as.numeric(df1$market_cap_usd)
@amrrs
amrrs / article-spell-checker.py
Created June 5, 2017 17:05
Article Spell-Checker in Python
import newspaper
from nltk import word_tokenize
import enchant
import re
url = 'https://hackernoon.com/dilemmas-of-a-digital-lifestyle-27c044940157' #input URL
my_article = newspaper.Article(url,language='en') # ### Extracting the Article Content
my_article.download()
my_article.parse()
d = enchant.Dict("en_US") # ### Spell-Checking the tokenized words
print(list(set([word.encode('ascii', 'ignore') for word in word_tokenize(my_article.text) if d.check(word) is False and re.match('^[a-zA-Z ]*$',word)] )))