New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add experimental machine learning #4585
Conversation
@@ -19,6 +19,6 @@ def translation_for_locale(content, locale) | |||
end | |||
|
|||
def information_texts_tabs | |||
[:basic, :debates, :community, :proposals, :polls, :layouts, :mailers, :management, :welcome] | |||
[:basic, :debates, :community, :proposals, :polls, :layouts, :mailers, :management, :welcome, :machine_learning] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [116/110] (https://rubystyle.guide#max-line-length)
|
||
return unless run_machine_learning_scripts | ||
|
||
if updated_file?(MachineLearning.proposals_taggings_filename) && updated_file?(MachineLearning.proposals_tags_filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [125/110] (https://rubystyle.guide#max-line-length)
update_machine_learning_info_for("tags") | ||
end | ||
|
||
if updated_file?(MachineLearning.investments_taggings_filename) && updated_file?(MachineLearning.investments_tags_filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [129/110] (https://rubystyle.guide#max-line-length)
files = { tags: [], related_content: [], comments_summary: [] } | ||
|
||
files[:tags] << proposals_tags_filename if File.exists?(DATA_FOLDER.join(proposals_tags_filename)) | ||
files[:tags] << proposals_taggings_filename if File.exists?(DATA_FOLDER.join(proposals_taggings_filename)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [112/110] (https://rubystyle.guide#max-line-length)
files[:tags] << proposals_tags_filename if File.exists?(DATA_FOLDER.join(proposals_tags_filename)) | ||
files[:tags] << proposals_taggings_filename if File.exists?(DATA_FOLDER.join(proposals_taggings_filename)) | ||
files[:tags] << investments_tags_filename if File.exists?(DATA_FOLDER.join(investments_tags_filename)) | ||
files[:tags] << investments_taggings_filename if File.exists?(DATA_FOLDER.join(investments_taggings_filename)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [116/110] (https://rubystyle.guide#max-line-length)
files[:tags] << proposals_taggings_filename if File.exists?(DATA_FOLDER.join(proposals_taggings_filename)) | ||
files[:tags] << investments_tags_filename if File.exists?(DATA_FOLDER.join(investments_tags_filename)) | ||
files[:tags] << investments_taggings_filename if File.exists?(DATA_FOLDER.join(investments_taggings_filename)) | ||
files[:related_content] << proposals_related_filename if File.exists?(DATA_FOLDER.join(proposals_related_filename)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [121/110] (https://rubystyle.guide#max-line-length)
files[:tags] << investments_tags_filename if File.exists?(DATA_FOLDER.join(investments_tags_filename)) | ||
files[:tags] << investments_taggings_filename if File.exists?(DATA_FOLDER.join(investments_taggings_filename)) | ||
files[:related_content] << proposals_related_filename if File.exists?(DATA_FOLDER.join(proposals_related_filename)) | ||
files[:related_content] << investments_related_filename if File.exists?(DATA_FOLDER.join(investments_related_filename)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [125/110] (https://rubystyle.guide#max-line-length)
files[:tags] << investments_taggings_filename if File.exists?(DATA_FOLDER.join(investments_taggings_filename)) | ||
files[:related_content] << proposals_related_filename if File.exists?(DATA_FOLDER.join(proposals_related_filename)) | ||
files[:related_content] << investments_related_filename if File.exists?(DATA_FOLDER.join(investments_related_filename)) | ||
files[:comments_summary] << proposals_comments_summary_filename if File.exists?(DATA_FOLDER.join(proposals_comments_summary_filename)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [140/110] (https://rubystyle.guide#max-line-length)
files[:related_content] << proposals_related_filename if File.exists?(DATA_FOLDER.join(proposals_related_filename)) | ||
files[:related_content] << investments_related_filename if File.exists?(DATA_FOLDER.join(investments_related_filename)) | ||
files[:comments_summary] << proposals_comments_summary_filename if File.exists?(DATA_FOLDER.join(proposals_comments_summary_filename)) | ||
files[:comments_summary] << investments_comments_summary_filename if File.exists?(DATA_FOLDER.join(investments_comments_summary_filename)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [144/110] (https://rubystyle.guide#max-line-length)
@@ -22,7 +22,7 @@ def deploysecret(key) | |||
set :use_sudo, false | |||
|
|||
set :linked_files, %w[config/database.yml config/secrets.yml] | |||
set :linked_dirs, %w[.bundle log tmp public/system public/assets public/ckeditor_assets] | |||
set :linked_dirs, %w[.bundle log tmp public/system public/assets public/ckeditor_assets public/machine_learning/data] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [117/110] (https://rubystyle.guide#max-line-length)
6d97497
to
e41127b
Compare
e41127b
to
ab1ed5a
Compare
create :machine_learning_info, script: "proposals_summary_comments_textrank.py", kind: "comments_summary" | ||
comments_file = MachineLearning::DATA_FOLDER.join(MachineLearning.comments_filename) | ||
File.open(comments_file, "w") { |file| file.write([].to_json) } | ||
proposals_comments_summary_file = MachineLearning::DATA_FOLDER.join(MachineLearning.proposals_comments_summary_filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/LineLength: Line is too long. [126/110] (https://rubystyle.guide#max-line-length)
ab1ed5a
to
05ea442
Compare
05ea442
to
eafbfd6
Compare
b84a1ba
to
2ed643b
Compare
b075221
to
981711b
Compare
981711b
to
28e4a30
Compare
28e4a30
to
52029e6
Compare
Note we're using the `call` method (which is equivalent to adding an ERB file) because we were getting an error calling `render` from the `dates` method: ``` ActionView::Base#lookup_context delegated to view_renderer.lookup_context, but view_renderer is nil: ``` It might be because we aren't rendering the `Adming::Budgets::DurationComponent` but just calling one method, and so there's no view context in this case.
This way the code is easier to follow; the code checking whether the list has contents is in the partial rendering the list. We also remove some duplication setting up related content in the controllers. For some reason, we have to manually ignore i18n keys which were automatically ignored when the code was in the view.
52029e6
to
4d27bbe
Compare
Objectives
Add experimental enrichment of CONSUL by running machine learning python scripts.
Visual Changes
New admin section
Script execution
Script success
Settings before
Settings after
Help section
Email success
Email error