0

我是 repidminer 的新手,对于一个学术项目,我正在尝试从论坛帖子中提取文本信息,例如http://www.tripadvisor.com/ShowTopic-g29220-i86-k1487815-Alamo-Maui_Hawaii.html

我已经尝试了很多并想出了 XPath 查询: //div[@class='postBody']/p[not(*)][text()]

这在谷歌文档中运行良好,但在 rapidminer 中却不行。

编辑:对不起,但您的建议查询不会在 rapidminer 中起作用。看我的rapidminer进程:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="web:get_webpage" compatibility="5.3.001" expanded="true" height="60" name="Get Page" width="90" x="45" y="75">
        <parameter key="url" value="http://www.tripadvisor.com/ShowTopic-g29220-i86-k1487815-Alamo-Maui_Hawaii.html"/>
        <parameter key="random_user_agent" value="true"/>
        <list key="query_parameters"/>
        <list key="request_properties"/>
      </operator>
      <operator activated="true" class="text:process_documents" compatibility="5.3.002" expanded="true" height="94" name="Process Documents" width="90" x="380" y="30">
        <process expanded="true">
          <operator activated="true" class="text:extract_information" compatibility="5.3.002" expanded="true" height="60" name="Extract Information" width="90" x="45" y="30">
            <parameter key="query_type" value="XPath"/>
            <list key="string_machting_queries"/>
            <list key="regular_expression_queries"/>
            <list key="regular_region_queries"/>
            <list key="xpath_queries">
              <parameter key="xpath1" value="//div[@class='postBody']"/>
              <parameter key="xpath2" value="//div[@class='postBody']/text()"/>
              <parameter key="xpath3" value="//div[@class='postBody']/p[not(*)][text()]"/>
            </list>
            <list key="namespaces"/>
            <list key="index_queries"/>
          </operator>
          <connect from_port="document" to_op="Extract Information" to_port="document"/>
          <connect from_op="Extract Information" from_port="document" to_port="document 1"/>
          <portSpacing port="source_document" spacing="0"/>
          <portSpacing port="sink_document 1" spacing="0"/>
          <portSpacing port="sink_document 2" spacing="0"/>
        </process>
      </operator>
      <connect from_op="Get Page" from_port="output" to_op="Process Documents" to_port="documents 1"/>
      <connect from_op="Process Documents" from_port="example set" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>

还有其他想法吗?

4

2 回答 2

0

你必须把和节点名称放在h:前面。divp

所以 xpath3 将是

//h:div[@class='postBody']/h:p[not(*)][text()]

于 2014-03-25T12:57:37.827 回答
0

如果您想获取整个帖子内容,请尝试:

 //div[@class='postBody']

或者:

 //div[@class='postBody']/text()

代替:

 //div[@class='postBody']/p[not(*)][text()]
于 2014-03-23T17:53:35.757 回答