我是个新手,我认为它在社会科学方面有很大的潜力。
我目前的一个项目是研究新闻文章是如何写关于网络和网络的(也就是人,而不是计算机网络)。为此,我从一个荷兰网站上收集了500篇文章,搜索字符串为“网络”,以获取关于灵活经济的新闻(这是新闻的主要来源,也是关于自营职业的主要新闻来源)。数据是荷兰提供的,但这与我的问题无关。
我喜欢用udpipe,是为了找出名词"netwerk“或动词"netwerken”是在什么语境中使用的。我尝试过kwic (从quanteda)获得这个信息,但这给了我“发生这种情况的窗口”。
我想使用引理(netwerk/netwerken)和共现运算符,但没有指定第二个项,只限于这个特定引理,而不是计算所有的共现。
这有可能吗?怎么可能?一个正常的语言例子:在我的网络中,我通过Facebook ->联系很多人,我想让网络和联系(动词)共存,我发现我的大多数客户通过我的网络->在这里我希望“我的网络”+“找到我的客户”。
任何帮助都是非常感谢的!
发布于 2020-05-04 18:20:44
看上去,“背景”比克瓦茨更有意义。如果句子层次、引理和限制字型足够,就应该是比较直接的。Udpipe也有荷兰型号可供预建。
#install.packages("udpipe")
library(udpipe)
#dl <- udpipe_download_model(language = "english")
# Check the name on download result
udmodel_en <- udpipe_load_model(file = "english-ud-2.0-170801.udpipe")
# Single and multisentence samples
txt <- c("Is this possible, and how? A normal language example: In
my network, I contact a lot of people through Facebook -> I would like to get co-occurrence of
network and contact (a verb) I found most of my clients through my network")
txtb <- c("I found most of my clients through my network")
x <- udpipe_annotate(udmodel_en, x = txt)
x <- as.data.frame(x)
xb <- udpipe_annotate(udmodel_en, x = txtb)
xb <- as.data.frame(xb)
# Raw preview
table(x$sentence[x$lemma == 'network'])
# Use x or xb here
xn <- udpipe_annotate(udmodel_en, x = x$sentence[x$lemma == 'network'])
xdf <- as.data.frame(xn)
# Reduce noise and group by sentence ~ doc_id to table
df_view = subset(xdf, xdf$upos %in% c('PRON','NOUN','VERB','PROPN'))
library(tidyverse)
df_view %>% group_by(doc_id) %>%
summarize(lemma = paste(sort(unique(lemma)),collapse=", "))在快速测试中,预先建立的模型将网络和网络定义为独立的根引理,因此一些粗糙的树干可能会更好地工作。然而,我确实确保了在句子中包含网络创造了新的匹配。
I found most of my clients through my network
1
I would like to get co-occurrence of network and contact (a verb)
1
In my network, I contact a lot of people through Facebook ->
1
A tibble: 3 × 2
doc_id lemma
<chr> <chr>
doc1 contact, Facebook, I, lot, my, network, people
doc2 co-occurrence, contact, get, I, like, network, verb
doc3 client, find, I, my, network通过匹配引理索引,也完全可以找到前面和后面的单词作为上下文,但这更接近kwic所做的事情。我没有包括动态的、共现的列表和排序,但是我想,当上下文词被提取出来时,它应该是相当琐碎的部分。我认为它可能需要一些停止词等,但随着更大的数据,这些应该变得更加明显。
https://stackoverflow.com/questions/61589671
复制相似问题