🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Rapidminer connectivity with google cloud platform for nlp processing

User: "Divyem"
New Altair Community Member
Updated by Jocelyn
I am trying to use the google cloud platform api based integration to fetch the entity value, same I am able to fo with the below command in the command line
curl -X POST      -H "Authorization: Bearer $(API_KEY)"      -H "Content-Type: application/json; charset=utf-8"      --data "{\         
  'document':{\                                             
    'type':'PLAIN_TEXT',\                                             
    'content':'Michelangelo Caravaggio, Italian painter, is known for\
              \'The Calling of Saint Matthew\'.'\
  },\                   

This gives me proper output response as below :-
{
  "entities": [
    {
      "name": "Michelangelo Caravaggio",
      "type": "PERSON",
      "metadata": {
        "mid": "/m/020bg",
        "wikipedia_url": "https://en.wikipedia.org/wiki/Caravaggio"
      },
      "salience": 0.82904786,
      "mentions": [
        {
          "text": {
            "content": "Michelangelo Caravaggio",
            "beginOffset": 0
          },
          "type": "PROPER"
        },
        {
          "text": {
            "content": "painter",
            "beginOffset": 33
          },
          "type": "COMMON"
        }
      ]
    },
    {
      "name": "Italian",
      "type": "LOCATION",
      "metadata": {},
      "salience": 0.13981608,
      "mentions": [
        {
          "text": {
            "content": "Italian",
            "beginOffset": 25
          },
          "type": "PROPER"
        }
      ]
    },
    {
      "name": "The Calling of Saint Matthew",
      "type": "EVENT",
      "metadata": {
        "mid": "/m/085_p7",
      },
      "salience": 0.031136045,
      "mentions": [
        {
          "text": {
            "content": "The Calling of Saint Matthew",
            "beginOffset": 69
          },
          "type": "PROPER"
        }
      ]
    }
  ],
  "language": "en"
}


Same I am trying to achieve using Enrich_data_by_webservice operator but everytime I do I am getting some error with various integration. Can anyone help me out. Below is the process I am using:-



<?xml version="1.0" encoding="UTF-8"?><process version="9.6.000">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="9.6.000" expanded="true" name="Process">
    <parameter key="logverbosity" value="init"/>
    <parameter key="random_seed" value="2001"/>
    <parameter key="send_mail" value="never"/>
    <parameter key="notification_email" value=""/>
    <parameter key="process_duration_for_mail" value="30"/>
    <parameter key="encoding" value="SYSTEM"/>
    <process expanded="true">
      <operator activated="true" class="generate_data" compatibility="9.6.000" expanded="true" height="68" name="Generate Data" width="90" x="45" y="34">
        <parameter key="target_function" value="random"/>
        <parameter key="number_examples" value="100"/>
        <parameter key="number_of_attributes" value="5"/>
        <parameter key="attributes_lower_bound" value="-10.0"/>
        <parameter key="attributes_upper_bound" value="10.0"/>
        <parameter key="gaussian_standard_deviation" value="10.0"/>
        <parameter key="largest_radius" value="10.0"/>
        <parameter key="use_local_random_seed" value="false"/>
        <parameter key="local_random_seed" value="1992"/>
        <parameter key="datamanagement" value="double_array"/>
        <parameter key="data_management" value="auto"/>
      </operator>
      <operator activated="true" class="web:enrich_data_by_webservice" compatibility="9.3.001" expanded="true" height="68" name="Enrich Data by Webservice" width="90" x="179" y="34">
        <parameter key="query_type" value="Regular Expression"/>
        <list key="string_machting_queries"/>
        <parameter key="attribute_type" value="Nominal"/>
        <list key="regular_expression_queries">
          <parameter key="text" value="(.*)"/>
        </list>
        <list key="regular_region_queries"/>
        <list key="xpath_queries"/>
        <list key="namespaces"/>
        <parameter key="ignore_CDATA" value="true"/>
        <parameter key="assume_html" value="true"/>
        <list key="index_queries"/>
        <list key="jsonpath_queries">
          <parameter key="entities" value="$..entities"/>
        </list>
        <parameter key="request_method" value="POST"/>
        <parameter key="body" value="{\&#10;  'document':{\&#10;    'type':'PLAIN_TEXT',\&#10;    'content':'Michelangelo Caravaggio, Italian painter, is known for\&#10;              \'The Calling of Saint Matthew\'.'\&#10;  },\&#10;  'encodingType':'UTF8'\&#10;}"/>
        <parameter key="url" value="https://language.googleapis.com/v1/documents:analyzeEntities"/>
        <parameter key="delay" value="0"/>
        <list key="request_properties">
          <parameter key="Authorization" value="Bearer ${API_KEY}"/>
          <parameter key="Content-Type" value="application/json; charset=utf-8&quot;"/>
        </list>
        <parameter key="encoding" value="SYSTEM"/>
        <parameter key="keep_sensitive_headers" value="true"/>
      </operator>
      <connect from_op="Generate Data" from_port="output" to_op="Enrich Data by Webservice" to_port="Example Set"/>
      <connect from_op="Enrich Data by Webservice" from_port="ExampleSet" 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>


Have edited the  api_key value to some variable value above.

Find more posts tagged with