Labels in cluster tree

anamorillo
anamorillo New Altair Community Member
edited November 5 in Community Q&A
Hello,
I'm clustring documents, to do that I use a "Process documents from files" operator (incluing tokenizers and filters), then I use the clustering operator
How could i put the label or the name of the document (introduced as class name in text directories) in the cluster tree and the folder view?
Thank you very much!

Answers

  • JEdward
    JEdward New Altair Community Member
    Hi anamorillo,

    I just noticed this has been sitting without a reply.  It's actually really simple, just change that attribute to an ID role before your clustering. 
    Have a look at this example:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="7.0.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="7.0.000" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="7.0.000" expanded="true" height="68" name="Retrieve Products" width="90" x="45" y="136">
            <parameter key="repository_entry" value="//Samples/data/Products"/>
          </operator>
          <operator activated="true" class="select_attributes" compatibility="7.0.000" expanded="true" height="82" name="Select Attributes" width="90" x="112" y="34">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="Product ID"/>
            <parameter key="invert_selection" value="true"/>
            <parameter key="include_special_attributes" value="true"/>
          </operator>
          <operator activated="true" class="set_role" compatibility="7.0.000" expanded="true" height="82" name="Set Role" width="90" x="313" y="187">
            <parameter key="attribute_name" value="Product Name"/>
            <parameter key="target_role" value="id"/>
            <list key="set_additional_roles"/>
          </operator>
          <operator activated="true" class="k_means" compatibility="7.0.000" expanded="true" height="82" name="Clustering" width="90" x="447" y="34">
            <parameter key="k" value="4"/>
          </operator>
          <connect from_op="Retrieve Products" from_port="output" to_op="Select Attributes" to_port="example set input"/>
          <connect from_op="Select Attributes" from_port="example set output" to_op="Set Role" to_port="example set input"/>
          <connect from_op="Set Role" from_port="example set output" to_op="Clustering" to_port="example set"/>
          <connect from_op="Clustering" from_port="cluster model" to_port="result 1"/>
          <connect from_op="Clustering" from_port="clustered set" to_port="result 2"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
          <portSpacing port="sink_result 3" spacing="0"/>
        </process>
      </operator>
    </process>