【发布时间】:2021-03-10 18:47:11
【问题描述】:
我有三个 XML-TEI-P5 文件要转换成语料库(stylo、quanteda 或 tm 语料库最好)。由于我从未使用过 XML,我无法提取文本并删除所有注释......(并保留所有特殊字母,如 ä、ü 等)
这是我迄今为止最远的一次:
library(xml2)
library(XML)
A1 <- read_xml("http://www.deutschestextarchiv.de/book/download_xml/schlegel_athenaeum_1798")
doc1 <- xmlParse(A1)
root1 <- xmlRoot(doc1)
print(root1)
另一种使用stylo 的方法(相同的文档,但将其保存在本地):
Corpus_alle <- load.corpus.and.parse(files = "all", corpus.dir = "TexteXML", markup.type= "XML",
corpus.lang = "German", splitting.rule = NULL,
sample.size = 10000, sampling = "no.sampling",
sample.overlap = 0, number.of.samples = 1,
sampling.with.replacement = FALSE, features = "w",
ngram.size = 1, preserve.case = FALSE,
encoding = "UTF-8")
【问题讨论】: