【发布时间】:2018-02-23 15:29:02
【问题描述】:
R 新手。
我正在使用tidytext::unnest_tokens 将长文本分解为以下使用的单个句子
tidy_drugs <- drugstext.raw %>%
unnest_tokens(sentence, Section, token="sentences")
所以我得到了一个 data.frame,其中所有句子都转换为行。
我想获取从长文本中未嵌套的每个句子的开始和结束位置。
这是一个长文本文件的示例。它来自药品标签。
<< *6.1 Clinical Trial Experience
Because clinical trials are conducted under widely varying conditions, adverse reaction rates observed in clinical trials of a drug cannot be directly compared to rates in the clinical trials of another drug and may not reflect the rates observed in practice.
The data below reflect exposure to ARDECRETRIS as monotherapy in 327 patients with classical Hodgkin lymphoma (HL) and systemic anaplastic large cell lymphoma (sALCL), including 160 patients in two uncontrolled single-arm trials (Studies 1 and 2) and 167 patients in one placebo-controlled randomized trial (Study 3).
In Studies 1 and 2, the most common adverse reactions were neutropenia, fatigue, nausea, anemia, cough, and vomiting.*
想要的结果是一个包含三列的数据框
【问题讨论】:
-
寻求帮助时,您应该包含一个简单的reproducible example,其中包含可用于测试和验证可能解决方案的示例输入和所需输出。
-
在问题陈述中添加了更多内容。感谢您的帮助。
标签: r text-mining tidytext