c:nmp:using_open_api_example
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| c:nmp:using_open_api_example [2017/05/08 12:32] – hkimscil | c:nmp:using_open_api_example [2020/06/09 13:43] (current) – removed hkimscil | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{all_comb.xlsx}} | ||
| - | < | ||
| - | library(RCurl) | ||
| - | library(rjson) | ||
| - | library(twitteR) | ||
| - | library(digest) | ||
| - | library(ROAuth) | ||
| - | library(KoNLP) | ||
| - | library(rJava) | ||
| - | library(tm) | ||
| - | library(wordcloud) | ||
| - | library(XLConnect) | ||
| - | |||
| - | setwd (" | ||
| - | |||
| - | rm(list=ls()) | ||
| - | ani<- file.path(" | ||
| - | |||
| - | anisheet <- readWorksheetFromFile(ani, | ||
| - | ani.text <- Corpus(VectorSource(anisheet$plotStory)) | ||
| - | result.text <- ani.text | ||
| - | |||
| - | |||
| - | myCorpus <- Corpus(VectorSource(result.text)) | ||
| - | myCorpus <- tm_map(myCorpus, | ||
| - | myCorpus <- tm_map(myCorpus, | ||
| - | myCorpus <- tm_map(myCorpus, | ||
| - | myStopwords <- c(stopwords(' | ||
| - | myCorpus < | ||
| - | |||
| - | inspect(myCorpus[1: | ||
| - | |||
| - | myTdm <- TermDocumentMatrix(myCorpus, | ||
| - | mat <- as.data.frame(as.matrix(myTdm)) | ||
| - | write.table(mat, | ||
| - | |||
| - | pal <- brewer.pal(12," | ||
| - | |||
| - | # 폰트 세팅. 띄어쓰기나 대소문자에 민감하다는 점에 주의 | ||
| - | # 맑은고딕 : windowsFonts(malgun=windowsFont(" | ||
| - | # 나눔고딕 : windowsFonts(malgun=windowsFont(" | ||
| - | windowsFonts(malgun=windowsFont(" | ||
| - | |||
| - | m <- as.matrix(myTdm) | ||
| - | # calculate the frequency of words | ||
| - | v <- sort(rowSums(m), | ||
| - | myNames <- names(v) | ||
| - | k <- which(names(v)==" | ||
| - | myNames[k] <- " | ||
| - | d <- data.frame(word=myNames, | ||
| - | # | ||
| - | wordcloud(d$word, | ||
| - | </ | ||
| - | |||
| - | {{ani_plot.png}} | ||
| - | |||
| - | {{myTdm-ani.txt}} | ||
| - | |||
| - | < | ||
| - | < | ||
| - | <meta charset=" | ||
| - | </ | ||
| - | < | ||
| - | |||
| - | <?php | ||
| - | |||
| - | $txt=''; | ||
| - | $myfile = fopen(" | ||
| - | $lines = file(' | ||
| - | $key = " | ||
| - | |||
| - | |||
| - | for ($i=0; | ||
| - | $q = $lines[$i]; | ||
| - | $url = " | ||
| - | |||
| - | echo " | ||
| - | echo "< | ||
| - | $xml = simplexml_load_file($url); | ||
| - | echo " | ||
| - | |||
| - | echo "< | ||
| - | echo $xml-> | ||
| - | echo "</ | ||
| - | |||
| - | |||
| - | foreach ($xml-> | ||
| - | $text = " \"" | ||
| - | $text .= " \"" | ||
| - | $text .= $oitemVal-> | ||
| - | $text .= " \"" | ||
| - | foreach ($oitemVal-> | ||
| - | $text .= " \" | ||
| - | } $oContentVal=""; | ||
| - | $text .= " | ||
| - | $text .= $oitemVal-> | ||
| - | $text .= $oitemVal-> | ||
| - | foreach ($oitemVal-> | ||
| - | $text .= " \" | ||
| - | } $oContentVal=""; | ||
| - | $text .= " | ||
| - | $text .= $oitemVal-> | ||
| - | |||
| - | $text .= " | ||
| - | echo " | ||
| - | fwrite($myfile, | ||
| - | } | ||
| - | |||
| - | $text=''; | ||
| - | |||
| - | } | ||
| - | |||
| - | fclose($myfile); | ||
| - | |||
| - | ?> | ||
| - | </ | ||
| - | </ | ||
c/nmp/using_open_api_example.1494216152.txt.gz · Last modified: by hkimscil
