【问题标题】:R TM package produces strange results with Inspect commandR TM 包使用 Inspect 命令产生奇怪的结果
【发布时间】:2021-08-30 12:00:46
【问题描述】:

我在使用 R 中 tm 包中的 inspect 函数时遇到了一点问题。

我有一个示例 2 行 data.table,定义如下:

dt <- data.table(doc_id = c(1, 2), text = c('the driver of the 1st vehicle', 'the light turned red'))

我创建了一个语料库并根据包文档进行检查:

corp <- VCorpus(DataframeSource(data.frame(dt)))
inspect(corp)

输出看起来很奇怪:

<VECSXP 0x1de5597db50>
  <VECSXP 0x1de5307d800>
    <VECSXP 0x1de5307d6c0>
      <STRSXP 0x1dd62b83b80>
        <CHARSXP 0x1de52b7f7e0>
        attributes: 
          <CHARSXP 0x1db146237a0>
          attributes: 
            <CHARSXP 0x1d342737728>
      <VECSXP 0x1de57fa88c0>
        <STRSXP 0x1dd728dc0a8>
        <VECSXP 0x1de57ab02a0>
          <REALSXP 0x1dd62b73198>
          <INTSXP 0x1dd62b731d0>

输出就这样一直持续下去,没有意义。它看起来不像应该根据包装插图打印的内容。对于这项工作的任何帮助,我将不胜感激!

系统信息:R 3.6.3,Windows 机器,tm_0.7-7。

【问题讨论】:

  • 无法复制。结果在我的机器上看起来与预期的一样。但我使用的是 R 4.0x 和 tm 07-8。

标签: r tm corpus


【解决方案1】:

好吧,事实证明我有一个不同的包加载了 inspect 函数。当我从 tm 采购检查时,这解决了问题。感谢收看!

【讨论】:

    猜你喜欢
    • 2015-02-04
    • 2013-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多