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 +4 -4
- data/app/assets/stylesheets/code_change_requests.scss +3 -0
- data/app/controllers/code_change_requests_controller.rb +75 -0
- data/app/helpers/code_change_requests_helper.rb +2 -0
- data/app/models/code_change_request.rb +2 -0
- data/app/models/wit_ai_parse_model_example.rb +8 -1
- data/app/views/code_change_requests/_code_change_request.json.jbuilder +2 -0
- data/app/views/code_change_requests/_form.html.erb +22 -0
- data/app/views/code_change_requests/edit.html.erb +6 -0
- data/app/views/code_change_requests/index.html.erb +27 -0
- data/app/views/code_change_requests/index.json.jbuilder +1 -0
- data/app/views/code_change_requests/new.html.erb +5 -0
- data/app/views/code_change_requests/show.html.erb +9 -0
- data/app/views/code_change_requests/show.json.jbuilder +1 -0
- data/app/views/ezii_os_files/_wit_ai_widget.html.erb +21 -2
- data/app/views/layouts/application.html.erb +36 -0
- data/config/routes.rb +1 -0
- data/db/development.sqlite3 +0 -0
- data/db/migrate/20190825142553_create_code_change_requests.rb +9 -0
- data/ezii-os-0.0.0.0.1.gem +0 -0
- data/ezii-os.gemspec +1 -1
- data/log/development.log +2026 -0
- data/test/controllers/code_change_requests_controller_test.rb +48 -0
- data/test/fixtures/code_change_requests.yml +7 -0
- data/test/models/code_change_request_test.rb +7 -0
- data/test/system/code_change_requests_test.rb +43 -0
- metadata +19 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3815af454ff9a00962a50805f7737d85776ed790aa4460703bacd66227a6e65e
|
4
|
+
data.tar.gz: fe23229da9631fb027a3b497db83b6427f253b5896d44d7a11b59c82195e3f0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 854dfa40a8012c0a633ebe2ae926190637ff77c153ad442d94815d732597cfcfcbb0383b1ea0dbd4ff22ae900c3accfc16032d249deb95ca60ec25c1a089e6a6
|
7
|
+
data.tar.gz: b950ac0ac446b40049162f9131c640e66720468c05081d763fac2062d32629570c3fe2dde9db2aa11841ba9cb43d370eec4ed90631f7f3265d42b89338d4db47
|
@@ -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
|
@@ -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,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,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 @@
|
|
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
|
-
|
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
data/db/development.sqlite3
CHANGED
Binary file
|
Binary file
|