Created
December 5, 2015 06:33
-
-
Save syu-id/0e1c4341800c008b4649 to your computer and use it in GitHub Desktop.
学習者コーパス論 2015.12.04 AWL と ASL の計算
This file contains hidden or 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
library(dplyr) | |
tokens <- read.csv('data/tokens.csv', as.is = TRUE) | |
result <- tokens %>% | |
group_by(native, id) %>% | |
summarise( | |
n_token = n(), | |
n_type = n_distinct(token), | |
n_sent = n_distinct(sen_no), | |
ttr = n_type / n_token, | |
gi = n_type / sqrt(n_token), | |
awl = mean(nchar(token)), | |
asl = n_token / n_sent | |
) | |
write.csv(result, file = 'out/2015.12.04-awl_asl.csv', row.names = FALSE) | |
result %>% | |
mutate_each( | |
funs(round(., 2)), | |
ttr:asl | |
) %>% | |
as.data.frame() %>% | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment