在分析文本时,识别文本数据中的人名可能很有用。
\n\n预先打包的对象tidytext包括:
nma_words)parts_of_speech)sentiments) 和?stop_words:)R 中是否有类似的对象(或其他地方的可访问格式)包含规范的名称列表?
\n\n作为参考,以下是data.frame随附的现有产品tidytext
nma_words\n# # A tibble: 44 x 2\n# word modifier\n# <chr> <chr> \n# 1 cannot negator \n# 2 could not negator \n# 3 did not negator \n# 4 does not negator \n# 5 had no negator \n# 6 have no negator \n# 7 may not negator \n# 8 never negator \n# 9 no negator \n# 10 not negator \n# # \xe2\x80\xa6 with 34 more rows\n\n\nparts_of_speech\n# # A tibble: 208,259 x 2\n# word pos \n# <chr> <chr> \n# 1 3-d Adjective\n# 2 3-d Noun \n# 3 4-f Noun \n# 4 4-h\'er Noun \n# 5 4-h Adjective\n# 6 a\' Adjective\n# 7 a-1 Noun \n# 8 a-axis Noun \n# 9 a-bomb Noun \n# 10 a-frame Noun \n# # \xe2\x80\xa6 with 208,249 more rows\n\n\nsentiments\n# # A tibble: 6,786 x 2\n# word sentiment\n# <chr> <chr> \n# 1 2-faces negative \n# 2 abnormal negative \n# 3 abolish negative \n# 4 abominable negative \n# 5 abominably negative \n# 6 abominate negative \n# 7 abomination negative \n# 8 abort negative \n# 9 aborted negative \n# 10 aborts negative \n# # \xe2\x80\xa6 with 6,776 more rows\n\n\nstop_words\n# # A tibble: 1,149 x 2\n# word lexicon\n# <chr> <chr> \n# 1 a SMART \n# 2 a\'s SMART \n# 3 able SMART \n# 4 about SMART \n# 5 above SMART \n# 6 according SMART \n# 7 accordingly SMART \n# 8 across SMART \n# 9 actually SMART \n# 10 after SMART \n# # \xe2\x80\xa6 with 1,139 more rows\n\nRun Code Online (Sandbox Code Playgroud)\n
像这样的数据集非常复杂,必须小心使用。此类数据的来源之一是性别数据包,其中包括多个姓名数据集,其中包括来自美国社会保障管理局的几个数据集。
library(genderdata)
head(ssa_national)
#> name year female male
#> 1 aaban 2007 0 5
#> 2 aaban 2009 0 6
#> 3 aaban 2010 0 9
#> 4 aaban 2011 0 11
#> 5 aaban 2012 0 11
#> 6 aabha 2011 7 0
Run Code Online (Sandbox Code Playgroud)
由reprex 包(v0.3.0)于 2020-04-27 创建