Sha256: 55fa194d88f6313a614e5550cc027644f5fff822eadec3d1fd3960ae46a3c2dd

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

<div id="entity-value-marking" style="display: none;">
<%=
File.read(file_path)

res = ""

Dir.mktmpdir do |dir| 
  Docsplit.extract_text([file_path], :ocr => false, :output => dir)

  res = Dir.glob('*.txt', base: dir).map { |f| File.read(File.join(dir, f)) }
end

raw_text = res[0]

raw_text.each_char.with_index.map { |char,i| "<span data-index=#{i}>#{char}</span>" }.join('').gsub("\n", "<br />").html_safe
%>
</div>


<dl>
<% 1.times do %>
  <%= form_with model: WitAiParseModelExample.new do |f| %>
    <%= f.hidden_field :parsable_resource, value: file_path %>
    <%= f.hidden_field :parsable_resource_text, value: raw_text %>
    <%= f.hidden_field :parsable_resource_entity_value_start_index %>
    <%= f.hidden_field :parsable_resource_entity_value_end_index %>

    <dt>
      Property name
      <%= f.text_field :entity_name %>
    </dt>
    <dd>
      <div style="display: none;">
        Search for the property
        <%= f.text_field :parsable_resource_query %>
      </div>

      <div style="display: none;">
        What is the correct value for this file?
        <%= f.text_field :entity_value %>
      </div>
    </dd>
    <%= f.submit "Search" %>
  <% end %>
<% end %>
</dl>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ezii-os-0.0.0.0.1 app/views/ezii_os_files/_wit_ai_widget.html.erb