我希望ProGuard和R8都可以执行代码收缩和优化:我确信经过一年的开发,R8不会像15年后的ProGuard那样酷。
Sys.setlocale("LC_ALL","Chinese") # reset to simplified Chinese encoding
library(foreign)
library(dplyr)
library(plyr)
library(tidyverse)
library(tm)
library(topicmodels)
seg <- readRDS(gzcon(url("https://www.dropbox.com/s/i1dhw2rzbr9i7xy/my_data.rds?dl=1")))
corpus <-Corpus(VectorSource(seg))
dtm <- DocumentTermMatrix(corpus,
control = list(
wordLengths=c(2, 20), # limiting the length of term
bounds = list(global = c(50, Inf)), # filter minimum freq.
removeNumbers = TRUE, # removeNumbers
weighting = weightTf, # weighing on term freq.
encoding = "UTF-8")) # reset to UTF8 encoding just in case
rowTotals <- slam::row_sums(dtm) # remove empty document
dtm <- dtm[rowTotals > 0, ]
#LDA assignment, set potential number of topics to 2
w_lda <- LDA(dtm, k = 2, control = list(seed = 1234))
#estimate word-topic assignment
library(tidytext)
w_topics <- tidy(w_lda, matrix = "beta")
head(w_topics)
# A tibble: 6 x 3
topic term beta
<int> <chr> <dbl>
1 1 "\"\xb7\xd6\xc1\xd1\"," 0.000405
2 2 "\"\xb7\xd6\xc1\xd1\"," 0.000618
3 1 "\"\xb8\xc9\xc2\xef\")" 0.0000184
4 2 "\"\xb8\xc9\xc2\xef\")" 0.0000400
5 1 "\"\xbb\xb9\"," 0.00869
6 2 "\"\xbb\xb9\"," 0.00264
标志启用R8 而不是 ProGuard。
有没有办法通过官方Android工具链使用这两种工具,即e。带有Android插件的Gradle吗?
答案 0 :(得分:1)
没有在Android Studio中同时运行R8和ProGuard的受支持方法。我建议您比较两个收缩器的结果,并确定要坚持使用哪一个。如果您发现R8的输出大于ProGuard,请通过使用this link提交错误报告来告知我们。