Any way to load script from file?

wessel
wessel New Altair Community Member
edited November 5 in Community Q&A
Can I load the contents of a script operator from a file?
This would help me a lot, because then I can work inside my own editor (eclipse/vim).

Best regards,

Wessel
Tagged:

Answers

  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    well.. you could set the parameter of the script operator via another script operator.. ;D

    Regards,
    Marco
  • JEdward
    JEdward New Altair Community Member
    Something like this?
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.013">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.013" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="text:read_document" compatibility="5.3.001" expanded="true" height="60" name="Read Document" width="90" x="45" y="255">
            <parameter key="file" value="myScriptFile.txt"/>
            <parameter key="use_file_extension_as_type" value="false"/>
          </operator>
          <operator activated="true" class="text:process_documents" compatibility="5.3.001" expanded="true" height="94" name="Process Documents" width="90" x="179" y="255">
            <parameter key="create_word_vector" value="false"/>
            <parameter key="add_meta_information" value="false"/>
            <parameter key="keep_text" value="true"/>
            <process expanded="true">
              <connect 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>
          <operator activated="true" class="extract_macro" compatibility="5.3.013" expanded="true" height="60" name="Extract Macro" width="90" x="179" y="165">
            <parameter key="macro" value="myScript"/>
            <parameter key="macro_type" value="data_value"/>
            <parameter key="attribute_name" value="text"/>
            <parameter key="example_index" value="1"/>
            <list key="additional_macros"/>
          </operator>
          <operator activated="true" class="execute_script" compatibility="5.3.013" expanded="true" height="76" name="Execute Script" width="90" x="246" y="75">
            <parameter key="script" value="%{myScript}"/>
          </operator>
          <connect from_op="Read Document" from_port="output" to_op="Process Documents" to_port="documents 1"/>
          <connect from_op="Process Documents" from_port="example set" to_op="Extract Macro" to_port="example set"/>
          <connect from_op="Extract Macro" from_port="example set" to_op="Execute Script" to_port="input 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
        </process>
      </operator>
    </process>
  • wessel
    wessel New Altair Community Member
    Impressive!