zsh
terminal
Add these lines in your ~/.bash_profile
file
# Show current git branch name
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
def pmi(df): | |
''' | |
Calculate the positive pointwise mutal information score for each entry | |
https://en.wikipedia.org/wiki/Pointwise_mutual_information | |
We use the log( p(y|x)/p(y) ), y being the column, x being the row | |
''' | |
# Get numpy array from pandas df | |
arr = df.as_matrix() | |
# p(y|x) probability of each t1 overlap within the row |
{0: 'tench, Tinca tinca', | |
1: 'goldfish, Carassius auratus', | |
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
3: 'tiger shark, Galeocerdo cuvieri', | |
4: 'hammerhead, hammerhead shark', | |
5: 'electric ray, crampfish, numbfish, torpedo', | |
6: 'stingray', | |
7: 'cock', | |
8: 'hen', | |
9: 'ostrich, Struthio camelus', |
curl -XDELETE 'localhost:9200/test' | |
curl -XPUT 'localhost:9200/test/doc/1' -d ' | |
{ | |
"sentence" : "Hi!", | |
"value" : 1 | |
} | |
' |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; | |
; Opinion Lexicon: Negative | |
; | |
; This file contains a list of NEGATIVE opinion words (or sentiment words). | |
; | |
; This file and the papers can all be downloaded from | |
; http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html | |
; | |
; If you use this list, please cite one of the following two papers: |