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
select | |
guid | |
, regexp_split_to_table(lower(post_content), '\s+') as word | |
, count(1) as word_count | |
from | |
alexblog_posts | |
group by | |
guid, word |
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
CASE LEFT([Word], 1) | |
WHEN "#" THEN "Hash Tag" | |
WHEN "@" THEN "User Reference" | |
ELSE "Regular Content" | |
END |
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
SCRIPT_STR(' | |
library(sentiment) | |
get_emotion(.arg1, algorithm = "bayes") | |
' | |
, ATTR([Tweet Text])) |
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
SCRIPT_STR(' | |
library(sentiment) | |
get_polarity(.arg1, algorithm = "bayes") | |
' | |
, ATTR([Tweet Text])) |
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
install.packages("devtools") | |
library(devtools) | |
install_github("aloth/sentiment/sentiment") |
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
install.packages("Rcpp") | |
install.packages("http://alexloth.com/utils/sentiment/current/sentiment.zip",repos=NULL) |
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
SCRIPT_REAL(' | |
import numpy as np | |
return np.corrcoef(_arg1,_arg2)[0,1] | |
', | |
SUM([Sales]), SUM([Profit])) |
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
SCRIPT_INT(' | |
kmeans(data.frame(.arg1,.arg2,.arg3),' + STR([Cluster Amount]) + ')$cluster; | |
', | |
SUM([Sales]), SUM([Profit]), SUM([Quantity])) |
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
SCRIPT_STR(' | |
newurl <- .arg1 | |
url <- "" | |
while(url != newurl){ | |
data <- system(toString(paste0("curl -I ", newurl)), intern=T) | |
if(sum(grepl("location: ", tolower(data))) == 0){ | |
url <- newurl | |
}else{ | |
data <- subset(data, tolower(substring(data, 1, 9))=="location:") | |
stringurl <- substring(data[1], 11, nchar(data[1])-1) |
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
REGEXP_EXTRACT( | |
[Post Message], | |
'((?:http|https)://(?:[\w_-]+(?:(?:\.[\w_-]+)+))(?:[\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-]))' | |
) |
OlderNewer