News stories retrieved by keywords for dicplomary and military without specifing county names.
print(ndoc(toks)) # Number of news articles
## [1] 122814
toks_jp <- tokens_select(toks, c('日本*', '東京'), window = 100)
The Japanese keywords for security commitment are
print(dict[['ja']]['foreign policy']) # Japanese words for commitment
## Dictionary object with 1 primary key entry and 2 nested levels.
## - [foreign policy]:
## - [commitment]:
## - 関与, コミットメント, 参画, 参与, 参加
## - [trust]:
## - 信頼*, 信憑*, 信用*
## - [concern]:
## - 懸念, 危惧, 疑惧, 憂虞, 不安, 心配
## - [isolationism]:
## - 孤立*, 一国*, 単独*
These are translations of those English words
print(dict[['en']]['foreign policy']) # Japanese words for commitment
## Dictionary object with 1 primary key entry and 2 nested levels.
## - [foreign policy]:
## - [commitment]:
## - commit*
## - [credibility]:
## - trust*, reliabl*
## - [concern]:
## - concern*
## - [isolationism]:
## - isolation*, nation*, unilater*
This plot shows the the total number of times the keywords appeared in the newspaper.
mt <- dfm(toks, groups = 'year')
mt_commit <- dfm(tokens_lookup(toks, dict[['ja']]['foreign policy']), groups = 'year', tolower = FALSE)
plot_keywords(t(mt_commit))
This chart shows the frequency of the US within 10 words from keywords (sub-categories are collapsed). Mentions of the US has gone up sharply after 2012. Solid line is the frequency in the contexts of the US-Japan relation, while dotted line is the frequency in any context.
dict_geo_sub <- dict_geo[['AMERICA']][['NORTH']]['US']
mt_jp <- count_keywords(toks_jp, dict_geo_sub, dict[['ja']]['foreign policy'])
plot_keywords(mt_jp)
mt_gl <- count_keywords(toks, dict_geo_sub, dict[['ja']]['foreign policy'])
plot_keywords(mt_gl, TRUE)