abstractor 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.md +14 -0
- data/Rakefile +33 -0
- data/app/assets/images/abstractor/add.png +0 -0
- data/app/assets/images/abstractor/ajax-loader.gif +0 -0
- data/app/assets/images/abstractor/bar.gif +0 -0
- data/app/assets/images/abstractor/bti_logo.jpg +0 -0
- data/app/assets/images/abstractor/bullet_arrow_down.png +0 -0
- data/app/assets/images/abstractor/bullet_arrow_up.png +0 -0
- data/app/assets/images/abstractor/cog.png +0 -0
- data/app/assets/images/abstractor/delete.png +0 -0
- data/app/assets/images/abstractor/edit.png +0 -0
- data/app/assets/images/abstractor/excel.png +0 -0
- data/app/assets/images/abstractor/favicon.ico +0 -0
- data/app/assets/images/abstractor/greencheck.gif +0 -0
- data/app/assets/images/abstractor/loading.gif +0 -0
- data/app/assets/images/abstractor/nu_logo.jpg +0 -0
- data/app/assets/images/abstractor/nubic_logo.png +0 -0
- data/app/assets/images/abstractor/page.png +0 -0
- data/app/assets/images/abstractor/rails.png +0 -0
- data/app/assets/images/abstractor/robert_h_lurie.jpg +0 -0
- data/app/assets/images/abstractor/show.png +0 -0
- data/app/assets/images/abstractor/switch_minus.gif +0 -0
- data/app/assets/images/abstractor/switch_plus.gif +0 -0
- data/app/assets/javascripts/abstractor/abstractor.js +89 -0
- data/app/assets/javascripts/abstractor/application.js +21 -0
- data/app/assets/javascripts/abstractor/combobox.js +301 -0
- data/app/assets/javascripts/abstractor/jquery/jquery.form.js +1074 -0
- data/app/assets/javascripts/abstractor/nested_attributes.js +69 -0
- data/app/assets/stylesheets/abstractor/abstractor_abstractions.css +312 -0
- data/app/assets/stylesheets/abstractor/application.css +21 -0
- data/app/assets/stylesheets/abstractor/jquery.ui.override.css.scss +73 -0
- data/app/controllers/abstractor/abstractor_abstraction_groups_controller.rb +5 -0
- data/app/controllers/abstractor/abstractor_abstractions_controller.rb +5 -0
- data/app/controllers/abstractor/abstractor_suggestions_controller.rb +5 -0
- data/app/controllers/abstractor/application_controller.rb +2 -0
- data/app/helpers/abstractor/application_helper.rb +4 -0
- data/app/models/abstractor/abstractor_abstraction.rb +6 -0
- data/app/models/abstractor/abstractor_abstraction_group.rb +6 -0
- data/app/models/abstractor/abstractor_abstraction_group_member.rb +6 -0
- data/app/models/abstractor/abstractor_abstraction_schema.rb +6 -0
- data/app/models/abstractor/abstractor_abstraction_schema_object_value.rb +6 -0
- data/app/models/abstractor/abstractor_abstraction_schema_predicate_variant.rb +6 -0
- data/app/models/abstractor/abstractor_abstraction_schema_relation.rb +6 -0
- data/app/models/abstractor/abstractor_abstraction_source.rb +6 -0
- data/app/models/abstractor/abstractor_object_type.rb +6 -0
- data/app/models/abstractor/abstractor_object_value.rb +6 -0
- data/app/models/abstractor/abstractor_object_value_variant.rb +6 -0
- data/app/models/abstractor/abstractor_relation_type.rb +6 -0
- data/app/models/abstractor/abstractor_rule_type.rb +6 -0
- data/app/models/abstractor/abstractor_subject.rb +6 -0
- data/app/models/abstractor/abstractor_subject_group.rb +6 -0
- data/app/models/abstractor/abstractor_subject_group_member.rb +6 -0
- data/app/models/abstractor/abstractor_subject_relation.rb +6 -0
- data/app/models/abstractor/abstractor_suggestion.rb +6 -0
- data/app/models/abstractor/abstractor_suggestion_object_value.rb +6 -0
- data/app/models/abstractor/abstractor_suggestion_source.rb +6 -0
- data/app/models/abstractor/abstractor_suggestion_status.rb +6 -0
- data/app/views/abstractor/abstractor_abstraction_groups/_form.html.haml +10 -0
- data/app/views/abstractor/abstractor_abstraction_groups/edit.html.haml +1 -0
- data/app/views/abstractor/abstractor_abstractions/_fields.html.haml +63 -0
- data/app/views/abstractor/abstractor_abstractions/_list.html.haml +45 -0
- data/app/views/abstractor/abstractor_abstractions/edit.html.haml +53 -0
- data/app/views/abstractor/abstractor_abstractions/show.html.haml +1 -0
- data/app/views/abstractor/shared/_error_messages.html.haml +5 -0
- data/config/cucumber.yml +8 -0
- data/config/routes.rb +7 -0
- data/db/migrate/20131227205140_create_abstractor_object_types.rb +10 -0
- data/db/migrate/20131227205219_create_abstractor_object_values.rb +10 -0
- data/db/migrate/20131227205256_create_abstractor_object_value_variants.rb +11 -0
- data/db/migrate/20131227205320_create_abstractor_relation_types.rb +10 -0
- data/db/migrate/20131227205354_create_abstractor_rule_types.rb +11 -0
- data/db/migrate/20131227205432_create_abstractor_abstraction_schemas.rb +13 -0
- data/db/migrate/20131227205456_create_abstractor_abstraction_schema_object_values.rb +10 -0
- data/db/migrate/20131227205529_create_abstractor_abstraction_schema_predicate_variants.rb +11 -0
- data/db/migrate/20131227205610_create_abstractor_abstraction_schema_relations.rb +11 -0
- data/db/migrate/20131227205652_create_abstractor_subjects.rb +12 -0
- data/db/migrate/20131227205732_create_abstractor_subject_relations.rb +11 -0
- data/db/migrate/20131227205831_create_abstractor_abstraction_sources.rb +11 -0
- data/db/migrate/20131227210211_create_abstractor_subject_groups.rb +10 -0
- data/db/migrate/20131227210244_create_abstractor_subject_group_members.rb +11 -0
- data/db/migrate/20131227210350_create_abstractor_abstraction_groups.rb +12 -0
- data/db/migrate/20131227210353_create_abstractor_abstraction_group_members.rb +11 -0
- data/db/migrate/20131227211050_create_abstractor_suggestion_statuses.rb +10 -0
- data/db/migrate/20131227211303_create_abstractor_abstractions.rb +15 -0
- data/db/migrate/20131227213427_create_abstractor_suggestions.rb +14 -0
- data/db/migrate/20131228041944_create_abstractor_suggestion_object_values.rb +11 -0
- data/db/migrate/20131228041945_create_abstractor_suggestion_sources.rb +16 -0
- data/db/seeds.rb +0 -0
- data/lib/abstractor.rb +8 -0
- data/lib/abstractor/abstractable.rb +190 -0
- data/lib/abstractor/core_ext/string.rb +99 -0
- data/lib/abstractor/engine.rb +14 -0
- data/lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb +37 -0
- data/lib/abstractor/methods/controllers/abstractor_abstractions_controller.rb +42 -0
- data/lib/abstractor/methods/controllers/abstractor_suggestions_controller.rb +28 -0
- data/lib/abstractor/methods/models/abstractor_abstraction.rb +65 -0
- data/lib/abstractor/methods/models/abstractor_abstraction_group.rb +37 -0
- data/lib/abstractor/methods/models/abstractor_abstraction_group_member.rb +17 -0
- data/lib/abstractor/methods/models/abstractor_abstraction_schema.rb +27 -0
- data/lib/abstractor/methods/models/abstractor_abstraction_schema_object_value.rb +17 -0
- data/lib/abstractor/methods/models/abstractor_abstraction_schema_predicate_variant.rb +16 -0
- data/lib/abstractor/methods/models/abstractor_abstraction_schema_relation.rb +18 -0
- data/lib/abstractor/methods/models/abstractor_abstraction_source.rb +29 -0
- data/lib/abstractor/methods/models/abstractor_object_type.rb +16 -0
- data/lib/abstractor/methods/models/abstractor_object_value.rb +24 -0
- data/lib/abstractor/methods/models/abstractor_object_value_variant.rb +16 -0
- data/lib/abstractor/methods/models/abstractor_relation_type.rb +16 -0
- data/lib/abstractor/methods/models/abstractor_rule_type.rb +17 -0
- data/lib/abstractor/methods/models/abstractor_subject.rb +258 -0
- data/lib/abstractor/methods/models/abstractor_subject_group.rb +19 -0
- data/lib/abstractor/methods/models/abstractor_subject_group_member.rb +17 -0
- data/lib/abstractor/methods/models/abstractor_subject_relation.rb +18 -0
- data/lib/abstractor/methods/models/abstractor_suggestion.rb +88 -0
- data/lib/abstractor/methods/models/abstractor_suggestion_object_value.rb +17 -0
- data/lib/abstractor/methods/models/abstractor_suggestion_source.rb +17 -0
- data/lib/abstractor/methods/models/abstractor_suggestion_status.rb +29 -0
- data/lib/abstractor/methods/models/soft_delete.rb +35 -0
- data/lib/abstractor/negation_detection.rb +43 -0
- data/lib/abstractor/parser.rb +76 -0
- data/lib/abstractor/setup.rb +24 -0
- data/lib/abstractor/user_interface.rb +40 -0
- data/lib/abstractor/utility.rb +8 -0
- data/lib/abstractor/version.rb +3 -0
- data/lib/generators/abstractor/install/install_generator.rb +118 -0
- data/lib/generators/abstractor/install/templates/controllers/abstractor_abstraction_groups_controller.rb +16 -0
- data/lib/generators/abstractor/install/templates/controllers/abstractor_abstractions_controller.rb +24 -0
- data/lib/generators/abstractor/install/templates/controllers/abstractor_suggestions_controller.rb +12 -0
- data/lib/generators/abstractor/install/templates/dictionaries.yml +235 -0
- data/lib/generators/abstractor/install/templates/helpers/abstractions_helper.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_abstraction.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_group.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_group_member.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_schema.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_schema_object_value.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_schema_predicate_variant.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_schema_relation.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_source.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_object_type.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_object_value.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_object_value_variant.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_relation_type.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_rule_type.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_subject.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_subject_group.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_subject_group_member.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_subject_relation.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_suggestion.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_suggestion_object_value.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_suggestion_source.rb +9 -0
- data/lib/generators/abstractor/install/templates/models/abstractor_suggestion_status.rb +9 -0
- data/lib/lingscope/build.xml +74 -0
- data/lib/lingscope/build/built-jar.properties +4 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/AbnerTokenizer.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/AnnotationComparer.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/Annotator.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/BaselineAnnotator.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/BaselineCueAnnotator.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/BaselineScopeAnnotator.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/CrfAnnotator.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/NegexAnnotator.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/NegexCueAnnotator.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/NegexScopeAnnotator.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/PosTagger.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/negex/GenNegEx.class +0 -0
- data/lib/lingscope/build/classes/lingscope/algorithms/negex/Sorter.class +0 -0
- data/lib/lingscope/build/classes/lingscope/drivers/AnnotatedFilesMerger.class +0 -0
- data/lib/lingscope/build/classes/lingscope/drivers/AnnotationComparerDriver.class +0 -0
- data/lib/lingscope/build/classes/lingscope/drivers/BaselineDriver.class +0 -0
- data/lib/lingscope/build/classes/lingscope/drivers/CrfDriver.class +0 -0
- data/lib/lingscope/build/classes/lingscope/drivers/CueAndPosFilesMerger.class +0 -0
- data/lib/lingscope/build/classes/lingscope/drivers/ModelTrainer.class +0 -0
- data/lib/lingscope/build/classes/lingscope/drivers/NegexDriver.class +0 -0
- data/lib/lingscope/build/classes/lingscope/drivers/PosTaggerDriver.class +0 -0
- data/lib/lingscope/build/classes/lingscope/drivers/SentencePosTagger.class +0 -0
- data/lib/lingscope/build/classes/lingscope/drivers/SentenceTagger.class +0 -0
- data/lib/lingscope/build/classes/lingscope/io/AnnotatedSentencesIO.class +0 -0
- data/lib/lingscope/build/classes/lingscope/structures/AnnotatedSentence.class +0 -0
- data/lib/lingscope/dist/README.TXT +32 -0
- data/lib/lingscope/dist/javadoc/allclasses-frame.html +80 -0
- data/lib/lingscope/dist/javadoc/allclasses-noframe.html +80 -0
- data/lib/lingscope/dist/javadoc/constant-values.html +199 -0
- data/lib/lingscope/dist/javadoc/deprecated-list.html +147 -0
- data/lib/lingscope/dist/javadoc/help-doc.html +224 -0
- data/lib/lingscope/dist/javadoc/index-files/index-1.html +188 -0
- data/lib/lingscope/dist/javadoc/index-files/index-10.html +149 -0
- data/lib/lingscope/dist/javadoc/index-files/index-11.html +158 -0
- data/lib/lingscope/dist/javadoc/index-files/index-12.html +157 -0
- data/lib/lingscope/dist/javadoc/index-files/index-13.html +177 -0
- data/lib/lingscope/dist/javadoc/index-files/index-14.html +155 -0
- data/lib/lingscope/dist/javadoc/index-files/index-15.html +152 -0
- data/lib/lingscope/dist/javadoc/index-files/index-16.html +146 -0
- data/lib/lingscope/dist/javadoc/index-files/index-2.html +158 -0
- data/lib/lingscope/dist/javadoc/index-files/index-3.html +165 -0
- data/lib/lingscope/dist/javadoc/index-files/index-4.html +146 -0
- data/lib/lingscope/dist/javadoc/index-files/index-5.html +219 -0
- data/lib/lingscope/dist/javadoc/index-files/index-6.html +149 -0
- data/lib/lingscope/dist/javadoc/index-files/index-7.html +155 -0
- data/lib/lingscope/dist/javadoc/index-files/index-8.html +185 -0
- data/lib/lingscope/dist/javadoc/index-files/index-9.html +164 -0
- data/lib/lingscope/dist/javadoc/index.html +74 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/AbnerTokenizer.html +280 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/AnnotationComparer.html +526 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/Annotator.html +401 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/BaselineAnnotator.html +375 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/BaselineCueAnnotator.html +309 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/BaselineScopeAnnotator.html +340 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/CrfAnnotator.html +340 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/NegexAnnotator.html +364 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/NegexCueAnnotator.html +309 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/NegexScopeAnnotator.html +309 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/PosTagger.html +268 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/AbnerTokenizer.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/AnnotationComparer.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/Annotator.html +299 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/BaselineAnnotator.html +189 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/BaselineCueAnnotator.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/BaselineScopeAnnotator.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/CrfAnnotator.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/NegexAnnotator.html +189 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/NegexCueAnnotator.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/NegexScopeAnnotator.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/PosTagger.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/GenNegEx.html +369 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/Sorter.html +253 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/class-use/GenNegEx.html +181 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/class-use/Sorter.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/package-frame.html +35 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/package-summary.html +165 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/package-tree.html +154 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/package-use.html +174 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/package-frame.html +53 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/package-summary.html +198 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/package-tree.html +160 -0
- data/lib/lingscope/dist/javadoc/lingscope/algorithms/package-use.html +202 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/AnnotatedFilesMerger.html +284 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/AnnotationComparerDriver.html +258 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/BaselineDriver.html +260 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/CrfDriver.html +262 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/CueAndPosFilesMerger.html +310 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/ModelTrainer.html +281 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/NegexDriver.html +262 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/PosTaggerDriver.html +289 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/SentencePosTagger.html +313 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/SentenceTagger.html +512 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/AnnotatedFilesMerger.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/AnnotationComparerDriver.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/BaselineDriver.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/CrfDriver.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/CueAndPosFilesMerger.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/ModelTrainer.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/NegexDriver.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/PosTaggerDriver.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/SentencePosTagger.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/SentenceTagger.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/package-frame.html +51 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/package-summary.html +195 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/package-tree.html +154 -0
- data/lib/lingscope/dist/javadoc/lingscope/drivers/package-use.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/io/AnnotatedSentencesIO.html +285 -0
- data/lib/lingscope/dist/javadoc/lingscope/io/class-use/AnnotatedSentencesIO.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/io/package-frame.html +33 -0
- data/lib/lingscope/dist/javadoc/lingscope/io/package-summary.html +158 -0
- data/lib/lingscope/dist/javadoc/lingscope/io/package-tree.html +154 -0
- data/lib/lingscope/dist/javadoc/lingscope/io/package-use.html +145 -0
- data/lib/lingscope/dist/javadoc/lingscope/structures/AnnotatedSentence.html +425 -0
- data/lib/lingscope/dist/javadoc/lingscope/structures/class-use/AnnotatedSentence.html +423 -0
- data/lib/lingscope/dist/javadoc/lingscope/structures/package-frame.html +33 -0
- data/lib/lingscope/dist/javadoc/lingscope/structures/package-summary.html +158 -0
- data/lib/lingscope/dist/javadoc/lingscope/structures/package-tree.html +154 -0
- data/lib/lingscope/dist/javadoc/lingscope/structures/package-use.html +209 -0
- data/lib/lingscope/dist/javadoc/overview-frame.html +51 -0
- data/lib/lingscope/dist/javadoc/overview-summary.html +168 -0
- data/lib/lingscope/dist/javadoc/overview-tree.html +159 -0
- data/lib/lingscope/dist/javadoc/package-list +5 -0
- data/lib/lingscope/dist/javadoc/resources/inherit.gif +0 -0
- data/lib/lingscope/dist/javadoc/stylesheet.css +29 -0
- data/lib/lingscope/dist/lib/abner.jar +0 -0
- data/lib/lingscope/dist/lib/commons-lang-2.4.jar +0 -0
- data/lib/lingscope/dist/lib/java_utils.jar +0 -0
- data/lib/lingscope/dist/lib/sptoolkit.jar +0 -0
- data/lib/lingscope/dist/lib/stanford-postagger.jar +0 -0
- data/lib/lingscope/dist/lingscope.jar +0 -0
- data/lib/lingscope/lingscope.zip +0 -0
- data/lib/lingscope/manifest.mf +3 -0
- data/lib/lingscope/nbproject/build-impl.xml +1338 -0
- data/lib/lingscope/nbproject/genfiles.properties +8 -0
- data/lib/lingscope/nbproject/private/config.properties +0 -0
- data/lib/lingscope/nbproject/private/private.properties +10 -0
- data/lib/lingscope/nbproject/private/private.xml +5 -0
- data/lib/lingscope/nbproject/project.properties +85 -0
- data/lib/lingscope/nbproject/project.xml +15 -0
- data/lib/lingscope/negation_models.zip +0 -0
- data/lib/lingscope/negation_models/baseline_cue_all_both.model +49 -0
- data/lib/lingscope/negation_models/baseline_cue_all_clinical.model +19 -0
- data/lib/lingscope/negation_models/crf_cue_all_both.model +0 -0
- data/lib/lingscope/negation_models/crf_cue_all_clinical.model +0 -0
- data/lib/lingscope/negation_models/crf_scope_cue_crf_all_both.model +0 -0
- data/lib/lingscope/negation_models/crf_scope_cue_crf_all_clinical.model +0 -0
- data/lib/lingscope/negation_models/crf_scope_cue_regex_all_both.model +0 -0
- data/lib/lingscope/negation_models/crf_scope_cue_regex_all_clinical.model +0 -0
- data/lib/lingscope/negation_models/crf_scope_words_all_both.model +0 -0
- data/lib/lingscope/negation_models/crf_scope_words_all_clinical.model +0 -0
- data/lib/lingscope/negation_models/crf_scope_words_crf_all_both.model +0 -0
- data/lib/lingscope/negation_models/crf_scope_words_crf_all_clinical.model +0 -0
- data/lib/lingscope/negation_models/crf_scope_words_regex_all_both.model +0 -0
- data/lib/lingscope/negation_models/crf_scope_words_regex_all_clinical.model +0 -0
- data/lib/lingscope/src/lingscope/algorithms/AbnerTokenizer.java +58 -0
- data/lib/lingscope/src/lingscope/algorithms/AnnotationComparer.java +207 -0
- data/lib/lingscope/src/lingscope/algorithms/Annotator.java +51 -0
- data/lib/lingscope/src/lingscope/algorithms/BaselineAnnotator.java +80 -0
- data/lib/lingscope/src/lingscope/algorithms/BaselineCueAnnotator.java +84 -0
- data/lib/lingscope/src/lingscope/algorithms/BaselineScopeAnnotator.java +101 -0
- data/lib/lingscope/src/lingscope/algorithms/CrfAnnotator.java +45 -0
- data/lib/lingscope/src/lingscope/algorithms/NegexAnnotator.java +52 -0
- data/lib/lingscope/src/lingscope/algorithms/NegexCueAnnotator.java +26 -0
- data/lib/lingscope/src/lingscope/algorithms/NegexScopeAnnotator.java +26 -0
- data/lib/lingscope/src/lingscope/algorithms/PosTagger.java +54 -0
- data/lib/lingscope/src/lingscope/algorithms/negex/GenNegEx.java +530 -0
- data/lib/lingscope/src/lingscope/algorithms/negex/Sorter.java +36 -0
- data/lib/lingscope/src/lingscope/drivers/AnnotatedFilesMerger.java +61 -0
- data/lib/lingscope/src/lingscope/drivers/AnnotationComparerDriver.java +22 -0
- data/lib/lingscope/src/lingscope/drivers/BaselineDriver.java +45 -0
- data/lib/lingscope/src/lingscope/drivers/CrfDriver.java +31 -0
- data/lib/lingscope/src/lingscope/drivers/CueAndPosFilesMerger.java +86 -0
- data/lib/lingscope/src/lingscope/drivers/ModelTrainer.java +39 -0
- data/lib/lingscope/src/lingscope/drivers/NegexDriver.java +32 -0
- data/lib/lingscope/src/lingscope/drivers/PosTaggerDriver.java +62 -0
- data/lib/lingscope/src/lingscope/drivers/SentencePosTagger.java +89 -0
- data/lib/lingscope/src/lingscope/drivers/SentenceTagger.java +158 -0
- data/lib/lingscope/src/lingscope/io/AnnotatedSentencesIO.java +53 -0
- data/lib/lingscope/src/lingscope/structures/AnnotatedSentence.java +105 -0
- data/lib/setup/data/ICD-O-3_CSV-metadata/Morphenglish.csv +1 -0
- data/lib/setup/data/ICD-O-3_CSV-metadata/Morphenglish.txt +2273 -0
- data/lib/setup/data/ICD-O-3_CSV-metadata/Topoenglish.csv +1 -0
- data/lib/setup/data/ICD-O-3_CSV-metadata/Topoenglish.txt +1342 -0
- data/lib/setup/data/ICD-O-3_CSV-metadata/icd-o3 readme.txt +21 -0
- data/lib/setup/data/custom_site_synonyms.csv +1 -0
- data/lib/setup/data/diagnosis_categorizations.csv +1 -0
- data/lib/setup/data/high_level_primary_cns_diagnosis_categorizations.yml +597 -0
- data/lib/setup/data/icdo3_sites_with_laterality.txt +11 -0
- data/lib/setup/data/site_site_categories.txt +28 -0
- data/lib/tasks/abstractor_tasks.rake +22 -0
- data/lib/tasks/cucumber.rake +65 -0
- metadata +754 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
module Abstractor
|
2
|
+
module Methods
|
3
|
+
module Models
|
4
|
+
module AbstractorObjectType
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, SoftDelete
|
7
|
+
|
8
|
+
# Associations
|
9
|
+
base.send :has_many, :abstractor_abstraction_schemas
|
10
|
+
|
11
|
+
base.send :attr_accessible, :deleted_at, :value
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Abstractor
|
2
|
+
module Methods
|
3
|
+
module Models
|
4
|
+
module AbstractorObjectValue
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, SoftDelete
|
7
|
+
|
8
|
+
# Associations
|
9
|
+
base.send :has_many, :abstractor_object_value_variants
|
10
|
+
base.send :has_many, :abstractor_abstraction_schema_object_values
|
11
|
+
base.send :has_many, :abstractor_abstraction_schemas, :through => :abstractor_abstraction_schema_object_values
|
12
|
+
|
13
|
+
#Validations
|
14
|
+
base.send :attr_accessible, :value, :abstractor_object_value_variants, :abstractor_abstraction_schema_object_values, :abstractor_abstraction_schemas
|
15
|
+
end
|
16
|
+
|
17
|
+
# Instance Methods
|
18
|
+
def object_variants
|
19
|
+
[value].concat(abstractor_object_value_variants.map(&:value))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Abstractor
|
2
|
+
module Methods
|
3
|
+
module Models
|
4
|
+
module AbstractorObjectValueVariant
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, SoftDelete
|
7
|
+
|
8
|
+
# Associations
|
9
|
+
base.send :belongs_to, :abstractor_object_value
|
10
|
+
|
11
|
+
base.send :attr_accessible, :abstractor_object_value, :abstractor_object_value_id, :deleted_at, :value
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Abstractor
|
2
|
+
module Methods
|
3
|
+
module Models
|
4
|
+
module AbstractorRelationType
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, SoftDelete
|
7
|
+
|
8
|
+
# Associations
|
9
|
+
base.send :has_many, :abstractor_abstraction_schema_relations
|
10
|
+
base.send :has_many, :subject_relations
|
11
|
+
base.send :attr_accessible, :deleted_at, :name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Abstractor
|
2
|
+
module Methods
|
3
|
+
module Models
|
4
|
+
module AbstractorRuleType
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, SoftDelete
|
7
|
+
|
8
|
+
# Associations
|
9
|
+
base.send :has_many, :abstractor_subjects
|
10
|
+
|
11
|
+
base.send :attr_accessible, :deleted_at, :description, :name, :abstractor_subjects
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,258 @@
|
|
1
|
+
module Abstractor
|
2
|
+
module Methods
|
3
|
+
module Models
|
4
|
+
module AbstractorSubject
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, SoftDelete
|
7
|
+
|
8
|
+
# Associations
|
9
|
+
base.send :belongs_to, :abstractor_rule_type
|
10
|
+
base.send :belongs_to, :abstractor_abstraction_schema
|
11
|
+
|
12
|
+
base.send :has_one, :abstractor_subject_group_member
|
13
|
+
base.send :has_one, :abstractor_subject_group, :through => :abstractor_subject_group_member
|
14
|
+
|
15
|
+
base.send :has_many, :abstractor_abstractions
|
16
|
+
base.send :has_many, :abstractor_abstraction_sources
|
17
|
+
|
18
|
+
base.send :has_many, :object_relations, :class_name => "Abstractor::AbstractorSubjectRelation", :foreign_key => "object_id"
|
19
|
+
base.send :has_many, :subject_relations, :class_name => "Abstractor::AbstractorSubjectRelation", :foreign_key => "subject_id"
|
20
|
+
|
21
|
+
|
22
|
+
base.send :attr_accessible, :abstractor_abstraction_schema, :abstractor_abstraction_schema_id, :abstractor_rule_type, :abstractor_rule_type_id, :subject_type
|
23
|
+
end
|
24
|
+
|
25
|
+
# Instance Methods
|
26
|
+
def abstract(about)
|
27
|
+
abstractor_abstraction = about.find_or_create_abstractor_abstraction(abstractor_abstraction_schema, self)
|
28
|
+
case abstractor_rule_type.name
|
29
|
+
when 'name/value'
|
30
|
+
abstract_name_value(about, abstractor_abstraction)
|
31
|
+
when 'value'
|
32
|
+
abstract_value(about, abstractor_abstraction)
|
33
|
+
when 'unknown'
|
34
|
+
abstract_unknown(about, abstractor_abstraction)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def abstract_unknown(about, abstractor_abstraction)
|
39
|
+
abstractor_abstraction_sources.each do |abstractor_abstraction_source|
|
40
|
+
create_unknown_abstractor_suggestion(about, abstractor_abstraction, abstractor_abstraction_source)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def abstract_value(about, abstractor_abstraction)
|
45
|
+
abstract_sentential_value(about, abstractor_abstraction)
|
46
|
+
abstractor_abstraction_sources.each do |abstractor_abstraction_source|
|
47
|
+
create_unknown_abstractor_suggestion(about, abstractor_abstraction, abstractor_abstraction_source)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def abstract_sentential_value(about, abstractor_abstraction)
|
52
|
+
abstractor_abstraction_sources.each do |abstractor_abstraction_source|
|
53
|
+
abstractor_abstraction_source.normalize_from_method_to_sources(about).each do |source|
|
54
|
+
abstractor_text = source[:source_type].find(source[:source_id]).send(source[:source_method])
|
55
|
+
abstractor_object_value_ids = abstractor_abstraction_schema.abstractor_object_values.map(&:id)
|
56
|
+
|
57
|
+
adapter = ActiveRecord::Base.connection.instance_values["config"][:adapter]
|
58
|
+
case adapter
|
59
|
+
when 'sqlserver'
|
60
|
+
abstractor_object_value_variants = Abstractor::AbstractorObjectValueVariant.where("abstractor_object_value_id in (?) AND EXISTS (SELECT 1 FROM #{source[:source_type].table_name} WHERE #{source[:source_type].table_name}.id = ? AND #{source[:source_type].table_name}.#{source[:source_method]} LIKE ('%' + abstractor_object_value_variants.value + '%'))", abstractor_object_value_ids, source[:source_id]).all
|
61
|
+
when 'sqlite3'
|
62
|
+
abstractor_object_value_variants = Abstractor::AbstractorObjectValueVariant.where("abstractor_object_value_id in (?) AND EXISTS (SELECT 1 FROM #{source[:source_type].table_name} WHERE #{source[:source_type].table_name}.id = ? AND #{source[:source_type].table_name}.#{source[:source_method]} LIKE ('%' || abstractor_object_value_variants.value || '%'))", abstractor_object_value_ids, source[:source_id]).all
|
63
|
+
when 'postgresql'
|
64
|
+
abstractor_object_value_variants = Abstractor::AbstractorObjectValueVariant.where("abstractor_object_value_id in (?) AND EXISTS (SELECT 1 FROM #{source[:source_type].table_name} WHERE #{source[:source_type].table_name}.id = ? AND #{source[:source_type].table_name}.#{source[:source_method]} ILIKE ('%' || abstractor_object_value_variants.value || '%'))", abstractor_object_value_ids, source[:source_id]).all
|
65
|
+
end
|
66
|
+
|
67
|
+
abstractor_object_values = abstractor_object_value_variants.map(&:abstractor_object_value).uniq
|
68
|
+
|
69
|
+
adapter = ActiveRecord::Base.connection.instance_values["config"][:adapter]
|
70
|
+
case adapter
|
71
|
+
when 'sqlserver'
|
72
|
+
abstractor_object_values.concat(Abstractor::AbstractorObjectValue.where("abstractor_object_values.id in (?) AND EXISTS (SELECT 1 FROM #{source[:source_type].table_name} WHERE #{source[:source_type].table_name}.id = ? AND #{source[:source_type].table_name}.#{source[:source_method]} LIKE ('%' + abstractor_object_values.value + '%'))", abstractor_object_value_ids, source[:source_id]).all).uniq
|
73
|
+
when 'sqlite3'
|
74
|
+
abstractor_object_values.concat(Abstractor::AbstractorObjectValue.where("abstractor_object_values.id in (?) AND EXISTS (SELECT 1 FROM #{source[:source_type].table_name} WHERE #{source[:source_type].table_name}.id = ? AND #{source[:source_type].table_name}.#{source[:source_method]} LIKE ('%' || abstractor_object_values.value || '%'))", abstractor_object_value_ids, source[:source_id]).all).uniq
|
75
|
+
when 'postgresql'
|
76
|
+
abstractor_object_values.concat(Abstractor::AbstractorObjectValue.where("abstractor_object_values.id in (?) AND EXISTS (SELECT 1 FROM #{source[:source_type].table_name} WHERE #{source[:source_type].table_name}.id = ? AND #{source[:source_type].table_name}.#{source[:source_method]} ILIKE ('%' || abstractor_object_values.value || '%'))", abstractor_object_value_ids, source[:source_id]).all).uniq
|
77
|
+
end
|
78
|
+
|
79
|
+
parser = Abstractor::Parser.new(abstractor_text)
|
80
|
+
abstractor_object_values.each do |abstractor_object_value|
|
81
|
+
object_variants(abstractor_object_value, abstractor_object_value_variants).each do |object_variant|
|
82
|
+
ranges = parser.range_all(Regexp.escape(object_variant.downcase))
|
83
|
+
if ranges.any?
|
84
|
+
ranges.each do |range|
|
85
|
+
sentence = parser.find_sentence(range)
|
86
|
+
if sentence
|
87
|
+
scoped_sentence = Abstractor::NegationDetection.parse_negation_scope(sentence[:sentence])
|
88
|
+
reject = (
|
89
|
+
Abstractor::NegationDetection.negated_match_value?(scoped_sentence[:scoped_sentence], object_variant) ||
|
90
|
+
Abstractor::NegationDetection.manual_negated_match_value?(sentence[:sentence], object_variant)
|
91
|
+
)
|
92
|
+
if !reject
|
93
|
+
suggest(abstractor_abstraction, abstractor_abstraction_source, object_variant.downcase, sentence[:sentence], source[:source_id], source[:source_type].to_s, source[:source_method], abstractor_object_value, nil, nil)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def abstract_name_value(about, abstractor_abstraction)
|
105
|
+
abstract_canonical_name_value(about, abstractor_abstraction)
|
106
|
+
abstract_sentential_name_value(about, abstractor_abstraction)
|
107
|
+
create_unknown_abstractor_suggestion_name_only(about, abstractor_abstraction)
|
108
|
+
abstractor_abstraction_sources.each do |abstractor_abstraction_source|
|
109
|
+
create_unknown_abstractor_suggestion(about, abstractor_abstraction, abstractor_abstraction_source)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def abstract_canonical_name_value(about, abstractor_abstraction)
|
114
|
+
abstractor_abstraction_sources.each do |abstractor_abstraction_source|
|
115
|
+
abstractor_abstraction_source.normalize_from_method_to_sources(about).each do |source|
|
116
|
+
abstractor_text = source[:source_type].find(source[:source_id]).send(source[:source_method])
|
117
|
+
parser = Abstractor::Parser.new(abstractor_text)
|
118
|
+
abstractor_abstraction_schema.predicate_variants.each do |predicate_variant|
|
119
|
+
abstractor_abstraction_schema.abstractor_object_values.each do |abstractor_object_value|
|
120
|
+
abstractor_object_value.object_variants.each do |object_variant|
|
121
|
+
match_value = "#{Regexp.escape(predicate_variant)}:\s*#{Regexp.escape(object_variant)}"
|
122
|
+
matches = parser.scan(match_value, word_boundary: true).uniq
|
123
|
+
matches.each do |match|
|
124
|
+
suggest(abstractor_abstraction, abstractor_abstraction_source, match, match, source[:source_id], source[:source_type].to_s, source[:source_method], abstractor_object_value, nil, nil)
|
125
|
+
end
|
126
|
+
|
127
|
+
match_value = "#{Regexp.escape(predicate_variant)}#{Regexp.escape(object_variant)}"
|
128
|
+
matches = parser.scan(match_value, word_boundary: true).uniq
|
129
|
+
matches.each do |match|
|
130
|
+
suggest(abstractor_abstraction, abstractor_abstraction_source, match, match, source[:source_id], source[:source_type].to_s, source[:source_method], abstractor_object_value, nil, nil)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def abstract_sentential_name_value(about, abstractor_abstraction)
|
140
|
+
abstractor_abstraction_sources.each do |abstractor_abstraction_source|
|
141
|
+
abstractor_abstraction_source.normalize_from_method_to_sources(about).each do |source|
|
142
|
+
abstractor_text = source[:source_type].find(source[:source_id]).send(source[:source_method])
|
143
|
+
parser = Abstractor::Parser.new(abstractor_text)
|
144
|
+
abstractor_abstraction_schema.predicate_variants.each do |predicate_variant|
|
145
|
+
ranges = parser.range_all(Regexp.escape(predicate_variant))
|
146
|
+
if ranges.any?
|
147
|
+
ranges.each do |range|
|
148
|
+
sentence = parser.find_sentence(range)
|
149
|
+
if sentence
|
150
|
+
abstractor_abstraction_schema.abstractor_object_values.each do |abstractor_object_value|
|
151
|
+
abstractor_object_value.object_variants.each do |object_variant|
|
152
|
+
match = parser.match_sentence(sentence[:sentence], Regexp.escape(object_variant))
|
153
|
+
if match
|
154
|
+
scoped_sentence = Abstractor::NegationDetection.parse_negation_scope(sentence[:sentence])
|
155
|
+
reject = (
|
156
|
+
Abstractor::NegationDetection.negated_match_value?(scoped_sentence[:scoped_sentence], predicate_variant) ||
|
157
|
+
Abstractor::NegationDetection.manual_negated_match_value?(sentence[:sentence], predicate_variant) ||
|
158
|
+
Abstractor::NegationDetection.negated_match_value?(scoped_sentence[:scoped_sentence], object_variant) ||
|
159
|
+
Abstractor::NegationDetection.manual_negated_match_value?(sentence[:sentence], object_variant)
|
160
|
+
)
|
161
|
+
if !reject
|
162
|
+
suggest(abstractor_abstraction, abstractor_abstraction_source, sentence[:sentence], sentence[:sentence], source[:source_id], source[:source_type].to_s, source[:source_method], abstractor_object_value, nil, nil)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def suggest(abstractor_abstraction, abstractor_abstraction_source, match_value, sentence_match_value, source_id, source_type, source_method, abstractor_object_value, unknown, not_applicable)
|
176
|
+
match_value.strip! unless match_value.nil?
|
177
|
+
sentence_match_value.strip! unless sentence_match_value.nil?
|
178
|
+
abstractor_suggestion = abstractor_abstraction.detect_abstractor_suggestion(abstractor_object_value.value) unless abstractor_object_value.nil?
|
179
|
+
if !abstractor_suggestion
|
180
|
+
abstractor_suggestion_status_needs_review = Abstractor::AbstractorSuggestionStatus.where(name: 'Needs review').first
|
181
|
+
abstractor_suggestion = Abstractor::AbstractorSuggestion.create(
|
182
|
+
abstractor_abstraction: abstractor_abstraction,
|
183
|
+
abstractor_suggestion_status: abstractor_suggestion_status_needs_review,
|
184
|
+
suggested_value: abstractor_object_value.try(:value),
|
185
|
+
unknown: unknown,
|
186
|
+
not_applicable: not_applicable
|
187
|
+
)
|
188
|
+
abstractor_suggestion.abstractor_suggestion_object_value = Abstractor::AbstractorSuggestionObjectValue.new(abstractor_object_value: abstractor_object_value)
|
189
|
+
end
|
190
|
+
|
191
|
+
abstractor_suggestion_source = abstractor_suggestion.detect_abstractor_suggestion_source(abstractor_abstraction_source, sentence_match_value, source_id, source_type)
|
192
|
+
if !abstractor_suggestion_source
|
193
|
+
Abstractor::AbstractorSuggestionSource.create(
|
194
|
+
abstractor_abstraction_source: abstractor_abstraction_source,
|
195
|
+
abstractor_suggestion: abstractor_suggestion,
|
196
|
+
match_value: match_value,
|
197
|
+
sentence_match_value: sentence_match_value,
|
198
|
+
source_id: source_id,
|
199
|
+
source_type: source_type,
|
200
|
+
source_method: source_method
|
201
|
+
)
|
202
|
+
end
|
203
|
+
abstractor_suggestion
|
204
|
+
end
|
205
|
+
|
206
|
+
def create_unknown_abstractor_suggestion_name_only(about, abstractor_abstraction)
|
207
|
+
abstractor_abstraction_sources.each do |abstractor_abstraction_source|
|
208
|
+
abstractor_abstraction_source.normalize_from_method_to_sources(about).each do |source|
|
209
|
+
abstractor_text = source[:source_type].find(source[:source_id]).send(source[:source_method])
|
210
|
+
parser = Abstractor::Parser.new(abstractor_text)
|
211
|
+
#Create an 'unknown' suggestion based on match name only if we have not made a suggstion
|
212
|
+
if abstractor_abstraction.abstractor_suggestions(true).empty?
|
213
|
+
abstractor_abstraction_schema.predicate_variants.each do |predicate_variant|
|
214
|
+
ranges = parser.range_all(Regexp.escape(predicate_variant))
|
215
|
+
if ranges
|
216
|
+
ranges.each do |range|
|
217
|
+
sentence = parser.find_sentence(range)
|
218
|
+
if sentence
|
219
|
+
scoped_sentence = Abstractor::NegationDetection.parse_negation_scope(sentence[:sentence])
|
220
|
+
reject = (
|
221
|
+
Abstractor::NegationDetection.negated_match_value?(scoped_sentence[:scoped_sentence], predicate_variant) ||
|
222
|
+
Abstractor::NegationDetection.manual_negated_match_value?(sentence[:sentence], predicate_variant)
|
223
|
+
)
|
224
|
+
if !reject
|
225
|
+
suggest(abstractor_abstraction, abstractor_abstraction_source, predicate_variant.downcase, sentence[:sentence], source[:source_id], source[:source_type].to_s, source[:source_method], nil, true, nil)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def create_unknown_abstractor_suggestion(about, abstractor_abstraction, abstractor_abstraction_source)
|
237
|
+
#Create an 'unknown' suggestion based on matching nothing only if we have not made a suggstion
|
238
|
+
abstractor_abstraction_source.normalize_from_method_to_sources(about).each do |source|
|
239
|
+
if abstractor_abstraction.abstractor_suggestions(true).empty?
|
240
|
+
suggest(abstractor_abstraction, abstractor_abstraction_source, nil, nil, source[:source_id], source[:source_type].to_s, source[:source_method], nil, true, nil)
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def groupable?
|
246
|
+
!abstractor_subject_group_member.nil?
|
247
|
+
end
|
248
|
+
|
249
|
+
private
|
250
|
+
|
251
|
+
def object_variants(abstractor_object_value, abstractor_object_value_variants)
|
252
|
+
aovv = abstractor_object_value_variants.select { |abstractor_object_value_variant| abstractor_object_value_variant.abstractor_object_value_id == abstractor_object_value.id }
|
253
|
+
[abstractor_object_value.value].concat(aovv.map(&:value))
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Abstractor
|
2
|
+
module Methods
|
3
|
+
module Models
|
4
|
+
module AbstractorSubjectGroup
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, SoftDelete
|
7
|
+
|
8
|
+
# Associations
|
9
|
+
base.send :has_many, :abstractor_subject_group_members
|
10
|
+
base.send :has_many, :abstractor_subjects, :through => :abstractor_subject_group_members
|
11
|
+
base.send :has_many, :abstractor_abstraction_groups
|
12
|
+
base.send :has_many, :abstractor_abstractions, :through => :abstractor_abstraction_groups
|
13
|
+
|
14
|
+
base.send :attr_accessible, :deleted_at, :name
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Abstractor
|
2
|
+
module Methods
|
3
|
+
module Models
|
4
|
+
module AbstractorSubjectGroupMember
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, SoftDelete
|
7
|
+
|
8
|
+
# Associations
|
9
|
+
base.send :belongs_to, :abstractor_subject_group
|
10
|
+
base.send :belongs_to, :abstractor_subject
|
11
|
+
|
12
|
+
base.send :attr_accessible, :abstractor_subject_group, :abstractor_subject_group_id, :abstractor_subject_id, :display_order, :deleted_at, :abstractor_subject
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Abstractor
|
2
|
+
module Methods
|
3
|
+
module Models
|
4
|
+
module AbstractorSubjectRelation
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, SoftDelete
|
7
|
+
|
8
|
+
# Associations
|
9
|
+
base.send :belongs_to, :abstractor_relation_type
|
10
|
+
base.send :belongs_to, :object, :class_name => "Abstractor::AbstractorSubject", :foreign_key => "object_id"
|
11
|
+
base.send :belongs_to, :subject, :class_name => "Abstractor::AbstractorSubject", :foreign_key => "subject_id"
|
12
|
+
|
13
|
+
base.send :attr_accessible, :abstractor_relation_type, :abstractor_relation_type_id, :object, :object_id, :subject, :subject_id, :deleted_at
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Abstractor
|
2
|
+
module Methods
|
3
|
+
module Models
|
4
|
+
module AbstractorSuggestion
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, SoftDelete
|
7
|
+
|
8
|
+
# Associations
|
9
|
+
base.send :belongs_to, :abstractor_abstraction
|
10
|
+
base.send :belongs_to, :abstractor_suggestion_status
|
11
|
+
|
12
|
+
base.send :has_one, :abstractor_suggestion_object_value
|
13
|
+
base.send :has_one, :abstractor_object_value, :through => :abstractor_suggestion_object_value
|
14
|
+
|
15
|
+
base.send :has_many, :abstractor_suggestion_sources
|
16
|
+
|
17
|
+
base.send :attr_accessible, :abstractor_abstraction, :abstractor_abstraction_id, :abstractor_suggestion_sources, :abstractor_suggestion_source_id, :abstractor_suggestion_status, :abstractor_suggestion_status_id, :suggested_value, :deleted_at, :unknown, :not_applicable
|
18
|
+
|
19
|
+
# Hooks
|
20
|
+
base.send :after_save, :update_abstraction_value, :if => lambda {|abstractor_suggestion| abstractor_suggestion.abstractor_suggestion_status_id_changed?}
|
21
|
+
base.send :after_save, :update_siblings_status, :if => lambda {|abstractor_suggestion| abstractor_suggestion.abstractor_suggestion_status_id_changed?}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Instance Methods
|
25
|
+
def update_abstraction_value
|
26
|
+
if abstractor_suggestion_status.accepted?
|
27
|
+
abstractor_abstraction.value = suggested_value
|
28
|
+
abstractor_abstraction.unknown = unknown
|
29
|
+
abstractor_abstraction.not_applicable = not_applicable
|
30
|
+
abstractor_abstraction.save!
|
31
|
+
elsif abstractor_suggestion_status.needs_review?
|
32
|
+
abstractor_abstraction.value = nil
|
33
|
+
abstractor_abstraction.unknown = nil
|
34
|
+
abstractor_abstraction.not_applicable = nil
|
35
|
+
abstractor_abstraction.save!
|
36
|
+
elsif abstractor_suggestion_status.rejected?
|
37
|
+
abstractor_abstraction.value = nil if abstractor_abstraction.value == suggested_value
|
38
|
+
abstractor_abstraction.unknown = nil if unknown && abstractor_abstraction.unknown == unknown
|
39
|
+
abstractor_abstraction.not_applicable = nil if not_applicable && abstractor_abstraction.not_applicable == not_applicable
|
40
|
+
abstractor_abstraction.save!
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def update_siblings_status
|
45
|
+
rejected_status = Abstractor::AbstractorSuggestionStatus.where(:name => 'Rejected').first
|
46
|
+
needs_review_status = Abstractor::AbstractorSuggestionStatus.where(:name => 'Needs review').first
|
47
|
+
|
48
|
+
if abstractor_suggestion_status.accepted?
|
49
|
+
#reject sibling suggestions
|
50
|
+
self.sibling_suggestions.each do |abstractor_suggestion|
|
51
|
+
abstractor_suggestion.abstractor_suggestion_status = rejected_status
|
52
|
+
abstractor_suggestion.save!
|
53
|
+
end
|
54
|
+
elsif abstractor_suggestion_status.needs_review?
|
55
|
+
#reset status on sibling suggestions
|
56
|
+
self.sibling_suggestions.each do |abstractor_suggestion|
|
57
|
+
abstractor_suggestion.abstractor_suggestion_status = needs_review_status
|
58
|
+
abstractor_suggestion.save!
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def display_value
|
64
|
+
if unknown
|
65
|
+
'unknown'
|
66
|
+
elsif not_applicable
|
67
|
+
'not applicable'
|
68
|
+
else
|
69
|
+
suggested_value
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def sibling_suggestions
|
74
|
+
abstractor_abstraction.abstractor_suggestions.where('id != ?', id)
|
75
|
+
end
|
76
|
+
|
77
|
+
def detect_abstractor_suggestion_source(abstractor_abstraction_source, sentence_match_value, source_id, source_type)
|
78
|
+
abstractor_suggestion_source = abstractor_suggestion_sources.detect do |abstractor_suggestion_source|
|
79
|
+
abstractor_suggestion_source.abstractor_abstraction_source == abstractor_abstraction_source &&
|
80
|
+
abstractor_suggestion_source.sentence_match_value == sentence_match_value &&
|
81
|
+
abstractor_suggestion_source.source_id == source_id &&
|
82
|
+
abstractor_suggestion_source.source_type == source_type
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|