ezii-os 0.0.0.0.1 → 0.0.0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 982c9ee02bbc7b3b1ba48ea07f0b02bb01de6fbae4b6c57af45225915b1f6fd1
4
- data.tar.gz: f84e0eb57a592f6bdb12787268674d00fd462485f3d2d8e49c65ec871b15dd51
3
+ metadata.gz: 3815af454ff9a00962a50805f7737d85776ed790aa4460703bacd66227a6e65e
4
+ data.tar.gz: fe23229da9631fb027a3b497db83b6427f253b5896d44d7a11b59c82195e3f0c
5
5
  SHA512:
6
- metadata.gz: cb9c8de87c2dd36f133edfa2094106b2eb4d7d2c831ecbc91a8cb720f18e45a0541af43f4de939a90159213ce99a06711dd97ad1f2fc9bb7b701426614c50da5
7
- data.tar.gz: f35a5b783001004a818bd3edef45b2685141b27bd585059ef726dca2054b52eaf258e085624be1a9af2e462e0144750cbbdb7ac91ecd1fd3122f7dcf0adb7c0f
6
+ metadata.gz: 854dfa40a8012c0a633ebe2ae926190637ff77c153ad442d94815d732597cfcfcbb0383b1ea0dbd4ff22ae900c3accfc16032d249deb95ca60ec25c1a089e6a6
7
+ data.tar.gz: b950ac0ac446b40049162f9131c640e66720468c05081d763fac2062d32629570c3fe2dde9db2aa11841ba9cb43d370eec4ed90631f7f3265d42b89338d4db47
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the CodeChangeRequests controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,75 @@
1
+ class CodeChangeRequestsController < ApplicationController
2
+ before_action :set_code_change_request, only: [:show, :edit, :update, :destroy]
3
+
4
+ skip_before_action :verify_authenticity_token
5
+ # GET /code_change_requests
6
+ # GET /code_change_requests.json
7
+ def index
8
+ @code_change_requests = CodeChangeRequest.all
9
+ end
10
+
11
+ # GET /code_change_requests/1
12
+ # GET /code_change_requests/1.json
13
+ def show
14
+ end
15
+
16
+ # GET /code_change_requests/new
17
+ def new
18
+ @code_change_request = CodeChangeRequest.new
19
+ end
20
+
21
+ # GET /code_change_requests/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /code_change_requests
26
+ # POST /code_change_requests.json
27
+ def create
28
+ @code_change_request = CodeChangeRequest.new(code_change_request_params)
29
+
30
+ respond_to do |format|
31
+ if @code_change_request.save
32
+ format.html { redirect_to @code_change_request, notice: 'Code change request was successfully created.' }
33
+ format.json { render :show, status: :created, location: @code_change_request }
34
+ else
35
+ format.html { render :new }
36
+ format.json { render json: @code_change_request.errors, status: :unprocessable_entity }
37
+ end
38
+ end
39
+ end
40
+
41
+ # PATCH/PUT /code_change_requests/1
42
+ # PATCH/PUT /code_change_requests/1.json
43
+ def update
44
+ respond_to do |format|
45
+ if @code_change_request.update(code_change_request_params)
46
+ format.html { redirect_to @code_change_request, notice: 'Code change request was successfully updated.' }
47
+ format.json { render :show, status: :ok, location: @code_change_request }
48
+ else
49
+ format.html { render :edit }
50
+ format.json { render json: @code_change_request.errors, status: :unprocessable_entity }
51
+ end
52
+ end
53
+ end
54
+
55
+ # DELETE /code_change_requests/1
56
+ # DELETE /code_change_requests/1.json
57
+ def destroy
58
+ @code_change_request.destroy
59
+ respond_to do |format|
60
+ format.html { redirect_to code_change_requests_url, notice: 'Code change request was successfully destroyed.' }
61
+ format.json { head :no_content }
62
+ end
63
+ end
64
+
65
+ private
66
+ # Use callbacks to share common setup or constraints between actions.
67
+ def set_code_change_request
68
+ @code_change_request = CodeChangeRequest.find(params[:id])
69
+ end
70
+
71
+ # Never trust parameters from the scary internet, only allow the white list through.
72
+ def code_change_request_params
73
+ params.require(:code_change_request).permit(:text)
74
+ end
75
+ end
@@ -0,0 +1,2 @@
1
+ module CodeChangeRequestsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class CodeChangeRequest < ApplicationRecord
2
+ end
@@ -2,7 +2,8 @@ class WitAiParseModelExample < ApplicationRecord
2
2
  belongs_to :wit_ai_parse_model
3
3
 
4
4
 
5
- after_create :make_wit_ai_request
5
+ # after_create :make_wit_ai_request
6
+ after_create :import_to_google_aml_nlp_ee
6
7
 
7
8
  def make_wit_ai_request
8
9
  wit_server = Wit.new(access_token: self.wit_ai_parse_model.wit_ai_server_token)
@@ -30,4 +31,10 @@ class WitAiParseModelExample < ApplicationRecord
30
31
 
31
32
  self.save!
32
33
  end
34
+
35
+ def import_to_google_aml_nlp_ee
36
+ # create jsonl for example and copy it to gstorage
37
+ # add jsonl to csv (csv should be namespaced by wit_ai_parse_model.id)
38
+ # import csv to gamllnlpee via http rest request
39
+ end
33
40
  end
@@ -0,0 +1,2 @@
1
+ json.extract! code_change_request, :id, :text, :created_at, :updated_at
2
+ json.url code_change_request_url(code_change_request, format: :json)
@@ -0,0 +1,22 @@
1
+ <%= form_with(model: code_change_request, local: true) do |form| %>
2
+ <% if code_change_request.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(code_change_request.errors.count, "error") %> prohibited this code_change_request from being saved:</h2>
5
+
6
+ <ul>
7
+ <% code_change_request.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= form.label :text %>
16
+ <%= form.text_field :text %>
17
+ </div>
18
+
19
+ <div class="actions">
20
+ <%= form.submit %>
21
+ </div>
22
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing Code Change Request</h1>
2
+
3
+ <%= render 'form', code_change_request: @code_change_request %>
4
+
5
+ <%= link_to 'Show', @code_change_request %> |
6
+ <%= link_to 'Back', code_change_requests_path %>
@@ -0,0 +1,27 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>Code Change Requests</h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <th>Text</th>
9
+ <th colspan="3"></th>
10
+ </tr>
11
+ </thead>
12
+
13
+ <tbody>
14
+ <% @code_change_requests.each do |code_change_request| %>
15
+ <tr>
16
+ <td><%= code_change_request.text %></td>
17
+ <td><%= link_to 'Show', code_change_request %></td>
18
+ <td><%= link_to 'Edit', edit_code_change_request_path(code_change_request) %></td>
19
+ <td><%= link_to 'Destroy', code_change_request, method: :delete, data: { confirm: 'Are you sure?' } %></td>
20
+ </tr>
21
+ <% end %>
22
+ </tbody>
23
+ </table>
24
+
25
+ <br>
26
+
27
+ <%= link_to 'New Code Change Request', new_code_change_request_path %>
@@ -0,0 +1 @@
1
+ json.array! @code_change_requests, partial: "code_change_requests/code_change_request", as: :code_change_request
@@ -0,0 +1,5 @@
1
+ <h1>New Code Change Request</h1>
2
+
3
+ <%= render 'form', code_change_request: @code_change_request %>
4
+
5
+ <%= link_to 'Back', code_change_requests_path %>
@@ -0,0 +1,9 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Text:</strong>
5
+ <%= @code_change_request.text %>
6
+ </p>
7
+
8
+ <%= link_to 'Edit', edit_code_change_request_path(@code_change_request) %> |
9
+ <%= link_to 'Back', code_change_requests_path %>
@@ -0,0 +1 @@
1
+ json.partial! "code_change_requests/code_change_request", code_change_request: @code_change_request
@@ -19,6 +19,16 @@ raw_text.each_char.with_index.map { |char,i| "<span data-index=#{i}>#{char}</spa
19
19
 
20
20
 
21
21
  <dl>
22
+
23
+ <p>
24
+ Specify an entity you want to annotate (either select previous or create a new one) and click the Search button.
25
+
26
+ Then you will see the raw text from the PDF and can select one occurence of the entity.
27
+
28
+ Just mark the text like you would mark text before copy & pasting something.
29
+
30
+ Once you confirm the text selection, the training data example will be automagically created for you.
31
+ </p>
22
32
  <% 1.times do %>
23
33
  <%= form_with model: WitAiParseModelExample.new do |f| %>
24
34
  <%= f.hidden_field :parsable_resource, value: file_path %>
@@ -27,8 +37,17 @@ raw_text.each_char.with_index.map { |char,i| "<span data-index=#{i}>#{char}</spa
27
37
  <%= f.hidden_field :parsable_resource_entity_value_end_index %>
28
38
 
29
39
  <dt>
30
- Property name
31
- <%= f.text_field :entity_name %>
40
+ <b>Property name</b>
41
+ <i>Either select from previously used entity names or type to add a new one.</i>
42
+ <%= f.text_field :entity_name,
43
+ list: "entity_names"
44
+ %>
45
+
46
+ <datalist id="entity_names">
47
+ <% WitAiParseModelExample.pluck(:entity_name).uniq.each do |entity_name| %>
48
+ <option value="<%= entity_name %>">
49
+ <% end %>
50
+ </datalist>
32
51
  </dt>
33
52
  <dd>
34
53
  <div style="display: none;">
@@ -13,4 +13,40 @@
13
13
  <h1><a href="/">eZii Operating System Start</a></h1>
14
14
  <%= yield %>
15
15
  </body>
16
+
17
+ <script
18
+ src="https://code.jquery.com/jquery-3.4.1.js"
19
+ integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
20
+ crossorigin="anonymous"></script>
21
+
22
+ <script>
23
+ Turbolinks.__visit = Turbolinks.visit
24
+ Turbolinks.visit = false;
25
+ </script>
26
+ <textarea
27
+ id="story" name="story"
28
+ rows="5" cols="33"
29
+
30
+ onClick="if(!confirm()) { return; };$.post('/code_change_requests', {code_change_request: {text: this.value}}, (data, status)=> { this.value = data;alert(this.value) });"
31
+ >
32
+ </textarea>
33
+
34
+ <a class="embedly-card" href="https://www.reddit.com/r/ruby/comments/cv8bqf/how_could_ruby_help_with_ai/ey2ql5r">Card</a>
35
+ <script async src="//embed.redditmedia.com/widgets/platform.js" charset="UTF-8"></script>
36
+
37
+ <footer>
38
+ <!-- I wish i could render the following in the web browser somehow and then display it with an erb conditional -->
39
+ <!-- Maybe it could work using artichoke -->
40
+ <!--
41
+ <widgetbot
42
+ server="<%= ENV['DISCORD_SERVER_ID'] %>"
43
+ channel="<%= ENV['DISCORD_CHANNEL_ID'] %>"
44
+ width="800"
45
+ height="600"
46
+ shard="https://disweb.deploys.io"
47
+ >
48
+ </widgetbot>
49
+ <script src="https://cdn.jsdelivr.net/npm/@widgetbot/html-embed"></script>
50
+ -->
51
+ </footer>
16
52
  </html>
data/config/routes.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  Rails.application.routes.draw do
2
+ resources :code_change_requests
2
3
  resources :banal_business_testcases
3
4
  resources :file_systems
4
5
  resources :wit_ai_parse_model_examples
Binary file
@@ -0,0 +1,9 @@
1
+ class CreateCodeChangeRequests < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :code_change_requests do |t|
4
+ t.string :text
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
Binary file
data/ezii-os.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ezii-os'
3
- s.version = '0.0.0.0.1'
3
+ s.version = '0.0.0.1.0'
4
4
  s.date = '2019-08-14'
5
5
  s.summary = "eZii operating system"
6
6
  s.description = "Web-based, operating on the cloud platform"