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,8 @@
|
|
1
|
+
build.xml.data.CRC32=f6f84b20
|
2
|
+
build.xml.script.CRC32=f044596d
|
3
|
+
build.xml.stylesheet.CRC32=28e38971@1.38.2.45
|
4
|
+
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
5
|
+
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
6
|
+
nbproject/build-impl.xml.data.CRC32=f6f84b20
|
7
|
+
nbproject/build-impl.xml.script.CRC32=46d3adf7
|
8
|
+
nbproject/build-impl.xml.stylesheet.CRC32=5183f3c0@1.51.1.46
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
compile.on.save=true
|
2
|
+
do.depend=false
|
3
|
+
do.jar=true
|
4
|
+
file.reference.abner.jar=/Users/shashank/Documents/libraries/abner.jar
|
5
|
+
file.reference.commons-lang-2.4.jar=/Users/shashank/Documents/libraries/commons-lang-2.4/commons-lang-2.4.jar
|
6
|
+
file.reference.sptoolkit.jar=/Users/shashank/Documents/libraries/sptoolkit.jar
|
7
|
+
file.reference.stanford-postagger.jar=/Users/shashank/Documents/libraries/stanford-postagger-full-2008-09-28/stanford-postagger.jar
|
8
|
+
javac.debug=true
|
9
|
+
javadoc.preview=true
|
10
|
+
user.properties.file=/Users/shashank/Library/Application Support/NetBeans/7.2beta/build.properties
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
3
|
+
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
|
4
|
+
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
5
|
+
</project-private>
|
@@ -0,0 +1,85 @@
|
|
1
|
+
annotation.processing.enabled=true
|
2
|
+
annotation.processing.enabled.in.editor=false
|
3
|
+
annotation.processing.run.all.processors=true
|
4
|
+
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
5
|
+
application.title=lingscope
|
6
|
+
application.vendor=shashank
|
7
|
+
build.classes.dir=${build.dir}/classes
|
8
|
+
build.classes.excludes=**/*.java,**/*.form
|
9
|
+
# This directory is removed when the project is cleaned:
|
10
|
+
build.dir=build
|
11
|
+
build.generated.dir=${build.dir}/generated
|
12
|
+
build.generated.sources.dir=${build.dir}/generated-sources
|
13
|
+
# Only compile against the classpath explicitly listed here:
|
14
|
+
build.sysclasspath=ignore
|
15
|
+
build.test.classes.dir=${build.dir}/test/classes
|
16
|
+
build.test.results.dir=${build.dir}/test/results
|
17
|
+
# Uncomment to specify the preferred debugger connection transport:
|
18
|
+
#debug.transport=dt_socket
|
19
|
+
debug.classpath=\
|
20
|
+
${run.classpath}
|
21
|
+
debug.test.classpath=\
|
22
|
+
${run.test.classpath}
|
23
|
+
# This directory is removed when the project is cleaned:
|
24
|
+
dist.dir=dist
|
25
|
+
dist.jar=${dist.dir}/lingscope.jar
|
26
|
+
dist.javadoc.dir=${dist.dir}/javadoc
|
27
|
+
endorsed.classpath=
|
28
|
+
excludes=
|
29
|
+
file.reference.abner.jar=..\\..\\libraries\\abner.jar
|
30
|
+
file.reference.commons-lang-2.4.jar=..\\..\\libraries\\commons-lang-2.4\\commons-lang-2.4.jar
|
31
|
+
file.reference.java_utils.jar=..\\java_utils\\dist\\java_utils.jar
|
32
|
+
file.reference.sptoolkit.jar=..\\..\\libraries\\sptoolkit.jar
|
33
|
+
file.reference.stanford-postagger.jar=..\\..\\libraries\\stanford-postagger-full-2008-09-28\\stanford-postagger.jar
|
34
|
+
includes=**
|
35
|
+
jar.compress=false
|
36
|
+
javac.classpath=\
|
37
|
+
${file.reference.java_utils.jar}:\
|
38
|
+
${file.reference.sptoolkit.jar}:\
|
39
|
+
${file.reference.abner.jar}:\
|
40
|
+
${file.reference.commons-lang-2.4.jar}:\
|
41
|
+
${file.reference.stanford-postagger.jar}
|
42
|
+
# Space-separated list of extra javac options
|
43
|
+
javac.compilerargs=
|
44
|
+
javac.deprecation=false
|
45
|
+
javac.processorpath=\
|
46
|
+
${javac.classpath}
|
47
|
+
javac.source=1.5
|
48
|
+
javac.target=1.5
|
49
|
+
javac.test.classpath=\
|
50
|
+
${javac.classpath}:\
|
51
|
+
${build.classes.dir}:\
|
52
|
+
${libs.junit.classpath}:\
|
53
|
+
${libs.junit_4.classpath}
|
54
|
+
javac.test.processorpath=\
|
55
|
+
${javac.test.classpath}
|
56
|
+
javadoc.additionalparam=
|
57
|
+
javadoc.author=false
|
58
|
+
javadoc.encoding=${source.encoding}
|
59
|
+
javadoc.noindex=false
|
60
|
+
javadoc.nonavbar=false
|
61
|
+
javadoc.notree=false
|
62
|
+
javadoc.private=false
|
63
|
+
javadoc.reference.commons-lang-2.4.jar=../../libraries/commons-lang-2.4/commons-lang-2.4-javadoc.jar
|
64
|
+
javadoc.splitindex=true
|
65
|
+
javadoc.use=true
|
66
|
+
javadoc.version=false
|
67
|
+
javadoc.windowtitle=
|
68
|
+
main.class=lingscope.Main
|
69
|
+
manifest.file=manifest.mf
|
70
|
+
meta.inf.dir=${src.dir}/META-INF
|
71
|
+
platform.active=default_platform
|
72
|
+
run.classpath=\
|
73
|
+
${javac.classpath}:\
|
74
|
+
${build.classes.dir}
|
75
|
+
# Space-separated list of JVM arguments used when running the project
|
76
|
+
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
77
|
+
# or test-sys-prop.name=value to set system properties for unit tests):
|
78
|
+
run.jvmargs=
|
79
|
+
run.test.classpath=\
|
80
|
+
${javac.test.classpath}:\
|
81
|
+
${build.test.classes.dir}
|
82
|
+
source.encoding=UTF-8
|
83
|
+
source.reference.commons-lang-2.4.jar=../../libraries/commons-lang-2.4/commons-lang-2.4-sources.jar
|
84
|
+
src.dir=src
|
85
|
+
test.src.dir=test
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project xmlns="http://www.netbeans.org/ns/project/1">
|
3
|
+
<type>org.netbeans.modules.java.j2seproject</type>
|
4
|
+
<configuration>
|
5
|
+
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
6
|
+
<name>lingscope</name>
|
7
|
+
<source-roots>
|
8
|
+
<root id="src.dir"/>
|
9
|
+
</source-roots>
|
10
|
+
<test-roots>
|
11
|
+
<root id="test.src.dir"/>
|
12
|
+
</test-roots>
|
13
|
+
</data>
|
14
|
+
</configuration>
|
15
|
+
</project>
|
Binary file
|
@@ -0,0 +1,49 @@
|
|
1
|
+
absence of
|
2
|
+
loss
|
3
|
+
lacks
|
4
|
+
fails
|
5
|
+
no
|
6
|
+
failed
|
7
|
+
absent
|
8
|
+
impossible
|
9
|
+
favored over
|
10
|
+
missing
|
11
|
+
over
|
12
|
+
rather than
|
13
|
+
fail
|
14
|
+
with the exception of
|
15
|
+
favored
|
16
|
+
none
|
17
|
+
no longer
|
18
|
+
( not
|
19
|
+
( no
|
20
|
+
except
|
21
|
+
may
|
22
|
+
lacked
|
23
|
+
unable
|
24
|
+
rule out
|
25
|
+
or
|
26
|
+
absence
|
27
|
+
exclude
|
28
|
+
lack
|
29
|
+
without
|
30
|
+
cannot
|
31
|
+
lacking
|
32
|
+
excluding
|
33
|
+
neither
|
34
|
+
not
|
35
|
+
failure
|
36
|
+
never
|
37
|
+
nor
|
38
|
+
either
|
39
|
+
can not
|
40
|
+
instead of
|
41
|
+
instead
|
42
|
+
could not
|
43
|
+
negative
|
44
|
+
with the notable exception of
|
45
|
+
denied
|
46
|
+
denies
|
47
|
+
allergy
|
48
|
+
allergies
|
49
|
+
allergic
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/*
|
2
|
+
* To change this template, choose Tools | Templates
|
3
|
+
* and open the template in the editor.
|
4
|
+
*/
|
5
|
+
|
6
|
+
package lingscope.algorithms;
|
7
|
+
|
8
|
+
import abner.Scanner;
|
9
|
+
import java.io.StringReader;
|
10
|
+
|
11
|
+
/**
|
12
|
+
*
|
13
|
+
* @author shashank
|
14
|
+
*/
|
15
|
+
public class AbnerTokenizer {
|
16
|
+
////////////////////////////////////////////////////////////////
|
17
|
+
/**
|
18
|
+
<p>Take raw text apply ABNER's built-in tokenization on it.
|
19
|
+
*/
|
20
|
+
public static String tokenize(String s) {
|
21
|
+
StringBuffer sb = new StringBuffer();
|
22
|
+
try {
|
23
|
+
Scanner scanner = new Scanner(new StringReader(s));
|
24
|
+
String t;
|
25
|
+
while ((t = scanner.nextToken()) != null) {
|
26
|
+
sb.append(t+" ");
|
27
|
+
if (t.toString().matches("[?!\\.]"))
|
28
|
+
sb.append("\n");
|
29
|
+
}
|
30
|
+
return sb.toString();
|
31
|
+
} catch (Exception e) {
|
32
|
+
System.err.println(e);
|
33
|
+
}
|
34
|
+
return sb.toString();
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Takes an input and splits the sentence by punctuations and spaces, then
|
39
|
+
* stitches it back together with a space and returns
|
40
|
+
* @param input the input string to process
|
41
|
+
* @return processed input string, where all words and punctuations are
|
42
|
+
* seperated by space
|
43
|
+
*/
|
44
|
+
public static String splitTermsByPunctuation(String input) {
|
45
|
+
if (input.isEmpty()) {
|
46
|
+
return "";
|
47
|
+
}
|
48
|
+
input = input.replaceAll("\\n", " ");
|
49
|
+
String ret = tokenize(input).trim();
|
50
|
+
if (ret.matches(".*\\w\\.$")) { // If a space is not put between the period in the end, then introduce one
|
51
|
+
ret += " .";
|
52
|
+
}
|
53
|
+
if (input.endsWith(".") && (!ret.endsWith("."))) {
|
54
|
+
ret += " .";
|
55
|
+
}
|
56
|
+
return ret;
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,207 @@
|
|
1
|
+
package lingscope.algorithms;
|
2
|
+
|
3
|
+
import generalutils.Statistics;
|
4
|
+
import java.util.List;
|
5
|
+
import lingscope.io.AnnotatedSentencesIO;
|
6
|
+
import lingscope.structures.AnnotatedSentence;
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Compares two annotations or two annotation files
|
10
|
+
* @author shashank
|
11
|
+
*/
|
12
|
+
public class AnnotationComparer {
|
13
|
+
|
14
|
+
private double tp;
|
15
|
+
private double fp;
|
16
|
+
private double fn;
|
17
|
+
private double tn;
|
18
|
+
private double perfectMatches;
|
19
|
+
private int totalSentences;
|
20
|
+
private int numFolds;
|
21
|
+
private double[] tpFolds;
|
22
|
+
private double[] fpFolds;
|
23
|
+
private double[] fnFolds;
|
24
|
+
private double[] tnFolds;
|
25
|
+
private double[] perfectMatchesFolds;
|
26
|
+
private double[] totalSentencesFolds;
|
27
|
+
|
28
|
+
public AnnotationComparer(int numFolds) {
|
29
|
+
this.numFolds = numFolds;
|
30
|
+
reset();
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Resets the values for the comparer
|
35
|
+
*/
|
36
|
+
public final void reset() {
|
37
|
+
tp = 0;
|
38
|
+
fp = 0;
|
39
|
+
fn = 0;
|
40
|
+
tn = 0;
|
41
|
+
perfectMatches = 0;
|
42
|
+
totalSentences = 0;
|
43
|
+
tpFolds = new double[numFolds];
|
44
|
+
resetFold(tpFolds, numFolds);
|
45
|
+
fpFolds = new double[numFolds];
|
46
|
+
resetFold(fpFolds, numFolds);
|
47
|
+
fnFolds = new double[numFolds];
|
48
|
+
resetFold(fnFolds, numFolds);
|
49
|
+
tnFolds = new double[numFolds];
|
50
|
+
resetFold(tnFolds, numFolds);
|
51
|
+
perfectMatchesFolds = new double[numFolds];
|
52
|
+
resetFold(perfectMatchesFolds, numFolds);
|
53
|
+
totalSentencesFolds = new double[numFolds];
|
54
|
+
resetFold(totalSentencesFolds, numFolds);
|
55
|
+
}
|
56
|
+
|
57
|
+
private void resetFold(double[] folds, int numFolds) {
|
58
|
+
for (int i = 0; i < numFolds; ++i) {
|
59
|
+
folds[i] = 0;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
public void compareAnnotationFiles(String goldFile, String testFile) {
|
64
|
+
List<AnnotatedSentence> goldSentences = AnnotatedSentencesIO.read(goldFile);
|
65
|
+
List<AnnotatedSentence> testSentences = AnnotatedSentencesIO.read(testFile);
|
66
|
+
if (goldSentences.size() != testSentences.size()) {
|
67
|
+
throw new RuntimeException("Number of sentences in gold and test file are not same");
|
68
|
+
}
|
69
|
+
for (int i = 0; i < goldSentences.size(); ++i) {
|
70
|
+
AnnotatedSentence goldSentence = goldSentences.get(i);
|
71
|
+
AnnotatedSentence testSentence = testSentences.get(i);
|
72
|
+
compareAnnotations(goldSentence, testSentence);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
public void compareAnnotations(AnnotatedSentence goldSentence, AnnotatedSentence testSentence) {
|
77
|
+
int localTp = 0;
|
78
|
+
int localFp = 0;
|
79
|
+
int localFn = 0;
|
80
|
+
int localTn = 0;
|
81
|
+
if (goldSentence.getIsAnnotatedTags().size() != testSentence.getIsAnnotatedTags().size()) {
|
82
|
+
System.err.println("Size mismatch GOLD: " + goldSentence.getRawText());
|
83
|
+
System.err.println("Size mismatch TEST: " + testSentence.getRawText());
|
84
|
+
}
|
85
|
+
int numTags = Math.min(goldSentence.getIsAnnotatedTags().size(), testSentence.getIsAnnotatedTags().size());
|
86
|
+
for (int i = 0; i < numTags; ++i) {
|
87
|
+
boolean goldTag = goldSentence.getIsAnnotatedTags().get(i);
|
88
|
+
boolean testTag = testSentence.getIsAnnotatedTags().get(i);
|
89
|
+
if (goldTag && testTag) {
|
90
|
+
++localTp;
|
91
|
+
} else if (goldTag && (!testTag)) {
|
92
|
+
++localFn;
|
93
|
+
} else if ((!goldTag) && testTag) {
|
94
|
+
++localFp;
|
95
|
+
} else if ((!goldTag) && (!testTag)) {
|
96
|
+
++localTn;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
int foldNum = totalSentences % numFolds;
|
100
|
+
tp += localTp;
|
101
|
+
fp += localFp;
|
102
|
+
fn += localFn;
|
103
|
+
tn += localTn;
|
104
|
+
tpFolds[foldNum] += localTp;
|
105
|
+
fpFolds[foldNum] += localFp;
|
106
|
+
fnFolds[foldNum] += localFn;
|
107
|
+
tnFolds[foldNum] += localTn;
|
108
|
+
if (localFp != 0) {
|
109
|
+
System.out.println("FP Gold: " + goldSentence.getRawText());
|
110
|
+
System.out.println("FP Test: " + testSentence.getRawText());
|
111
|
+
}
|
112
|
+
if (localFn != 0) {
|
113
|
+
System.out.println("FN Gold: " + goldSentence.getRawText());
|
114
|
+
System.out.println("FN Test: " + testSentence.getRawText());
|
115
|
+
}
|
116
|
+
if (localFp == 0 && localFn == 0) {
|
117
|
+
++perfectMatches;
|
118
|
+
++perfectMatchesFolds[foldNum];
|
119
|
+
}
|
120
|
+
++totalSentences;
|
121
|
+
++totalSentencesFolds[foldNum];
|
122
|
+
}
|
123
|
+
|
124
|
+
public void printStats() {
|
125
|
+
System.out.println("TP: " + tp);
|
126
|
+
System.out.println("FP: " + fp);
|
127
|
+
System.out.println("FN: " + fn);
|
128
|
+
System.out.println("TN: " + tn);
|
129
|
+
double precision = getPrecision(tp, fp);
|
130
|
+
double recall = getRecall(tp, fn);
|
131
|
+
System.out.println("Overall precision: " + precision);
|
132
|
+
System.out.println("Overall recall: " + recall);
|
133
|
+
System.out.println("Overall F1-score: " + getFScore(recall, precision));
|
134
|
+
System.out.println("Overall Accuracy: " + getAccuracy(tp, fp, fn, tn));
|
135
|
+
System.out.println("Overall Perfect : " + getPerfectAccuracy(perfectMatches, totalSentences));
|
136
|
+
double[] recalls = getRecalls();
|
137
|
+
double[] precisions = getPrecisions();
|
138
|
+
double[] fScores = getFScores(recalls, precisions);
|
139
|
+
double[] accuracies = getAccuracies();
|
140
|
+
double[] perfectAccuracies = getPerfectAccuracies();
|
141
|
+
System.out.println("Average precision: " + Statistics.mean(precisions) + " +/- " + Statistics.stdDev(precisions));
|
142
|
+
System.out.println("Average recall: " + Statistics.mean(recalls) + " +/- " + Statistics.stdDev(recalls));
|
143
|
+
System.out.println("Average F1-score: " + Statistics.mean(fScores) + " +/- " + Statistics.stdDev(fScores));
|
144
|
+
System.out.println("Average Accuracy: " + Statistics.mean(accuracies) + " +/- " + Statistics.stdDev(accuracies));
|
145
|
+
System.out.println("Average Perfect: " + Statistics.mean(perfectAccuracies) + " +/- " + Statistics.stdDev(perfectAccuracies));
|
146
|
+
}
|
147
|
+
|
148
|
+
public double[] getRecalls() {
|
149
|
+
double[] recalls = new double[numFolds];
|
150
|
+
for (int i = 0; i < numFolds; ++i) {
|
151
|
+
recalls[i] = getRecall(tpFolds[i], fnFolds[i]);
|
152
|
+
}
|
153
|
+
return recalls;
|
154
|
+
}
|
155
|
+
|
156
|
+
public double[] getPrecisions() {
|
157
|
+
double[] precisions = new double[numFolds];
|
158
|
+
for (int i = 0; i < numFolds; ++i) {
|
159
|
+
precisions[i] = getPrecision(tpFolds[i], fpFolds[i]);
|
160
|
+
}
|
161
|
+
return precisions;
|
162
|
+
}
|
163
|
+
|
164
|
+
public double[] getFScores(double[] recalls, double[] precisions) {
|
165
|
+
double[] fScores = new double[numFolds];
|
166
|
+
for (int i = 0; i < numFolds; ++i) {
|
167
|
+
fScores[i] = getFScore(recalls[i], precisions[i]);
|
168
|
+
}
|
169
|
+
return fScores;
|
170
|
+
}
|
171
|
+
|
172
|
+
public double[] getAccuracies() {
|
173
|
+
double[] accuracies = new double[numFolds];
|
174
|
+
for (int i = 0; i < numFolds; ++i) {
|
175
|
+
accuracies[i] = getAccuracy(tpFolds[i], fpFolds[i], fnFolds[i], tnFolds[i]);
|
176
|
+
}
|
177
|
+
return accuracies;
|
178
|
+
}
|
179
|
+
|
180
|
+
public double[] getPerfectAccuracies() {
|
181
|
+
double[] pcss = new double[numFolds];
|
182
|
+
for (int i = 0; i < numFolds; ++i) {
|
183
|
+
pcss[i] = getPerfectAccuracy(perfectMatchesFolds[i], totalSentencesFolds[i]);
|
184
|
+
}
|
185
|
+
return pcss;
|
186
|
+
}
|
187
|
+
|
188
|
+
public double getPerfectAccuracy(double trues, double total) {
|
189
|
+
return trues / total;
|
190
|
+
}
|
191
|
+
|
192
|
+
public double getAccuracy(double tp, double fp, double fn, double tn) {
|
193
|
+
return (tp + tn) / (tp + fp + fn + tn);
|
194
|
+
}
|
195
|
+
|
196
|
+
public double getRecall(double tp, double fn) {
|
197
|
+
return tp / (tp + fn);
|
198
|
+
}
|
199
|
+
|
200
|
+
public double getPrecision(double tp, double fp) {
|
201
|
+
return tp / (tp + fp);
|
202
|
+
}
|
203
|
+
|
204
|
+
public double getFScore(double recall, double precision) {
|
205
|
+
return 2 * precision * recall / (recall + precision);
|
206
|
+
}
|
207
|
+
}
|