abstractor 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (346) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +14 -0
  4. data/Rakefile +33 -0
  5. data/app/assets/images/abstractor/add.png +0 -0
  6. data/app/assets/images/abstractor/ajax-loader.gif +0 -0
  7. data/app/assets/images/abstractor/bar.gif +0 -0
  8. data/app/assets/images/abstractor/bti_logo.jpg +0 -0
  9. data/app/assets/images/abstractor/bullet_arrow_down.png +0 -0
  10. data/app/assets/images/abstractor/bullet_arrow_up.png +0 -0
  11. data/app/assets/images/abstractor/cog.png +0 -0
  12. data/app/assets/images/abstractor/delete.png +0 -0
  13. data/app/assets/images/abstractor/edit.png +0 -0
  14. data/app/assets/images/abstractor/excel.png +0 -0
  15. data/app/assets/images/abstractor/favicon.ico +0 -0
  16. data/app/assets/images/abstractor/greencheck.gif +0 -0
  17. data/app/assets/images/abstractor/loading.gif +0 -0
  18. data/app/assets/images/abstractor/nu_logo.jpg +0 -0
  19. data/app/assets/images/abstractor/nubic_logo.png +0 -0
  20. data/app/assets/images/abstractor/page.png +0 -0
  21. data/app/assets/images/abstractor/rails.png +0 -0
  22. data/app/assets/images/abstractor/robert_h_lurie.jpg +0 -0
  23. data/app/assets/images/abstractor/show.png +0 -0
  24. data/app/assets/images/abstractor/switch_minus.gif +0 -0
  25. data/app/assets/images/abstractor/switch_plus.gif +0 -0
  26. data/app/assets/javascripts/abstractor/abstractor.js +89 -0
  27. data/app/assets/javascripts/abstractor/application.js +21 -0
  28. data/app/assets/javascripts/abstractor/combobox.js +301 -0
  29. data/app/assets/javascripts/abstractor/jquery/jquery.form.js +1074 -0
  30. data/app/assets/javascripts/abstractor/nested_attributes.js +69 -0
  31. data/app/assets/stylesheets/abstractor/abstractor_abstractions.css +312 -0
  32. data/app/assets/stylesheets/abstractor/application.css +21 -0
  33. data/app/assets/stylesheets/abstractor/jquery.ui.override.css.scss +73 -0
  34. data/app/controllers/abstractor/abstractor_abstraction_groups_controller.rb +5 -0
  35. data/app/controllers/abstractor/abstractor_abstractions_controller.rb +5 -0
  36. data/app/controllers/abstractor/abstractor_suggestions_controller.rb +5 -0
  37. data/app/controllers/abstractor/application_controller.rb +2 -0
  38. data/app/helpers/abstractor/application_helper.rb +4 -0
  39. data/app/models/abstractor/abstractor_abstraction.rb +6 -0
  40. data/app/models/abstractor/abstractor_abstraction_group.rb +6 -0
  41. data/app/models/abstractor/abstractor_abstraction_group_member.rb +6 -0
  42. data/app/models/abstractor/abstractor_abstraction_schema.rb +6 -0
  43. data/app/models/abstractor/abstractor_abstraction_schema_object_value.rb +6 -0
  44. data/app/models/abstractor/abstractor_abstraction_schema_predicate_variant.rb +6 -0
  45. data/app/models/abstractor/abstractor_abstraction_schema_relation.rb +6 -0
  46. data/app/models/abstractor/abstractor_abstraction_source.rb +6 -0
  47. data/app/models/abstractor/abstractor_object_type.rb +6 -0
  48. data/app/models/abstractor/abstractor_object_value.rb +6 -0
  49. data/app/models/abstractor/abstractor_object_value_variant.rb +6 -0
  50. data/app/models/abstractor/abstractor_relation_type.rb +6 -0
  51. data/app/models/abstractor/abstractor_rule_type.rb +6 -0
  52. data/app/models/abstractor/abstractor_subject.rb +6 -0
  53. data/app/models/abstractor/abstractor_subject_group.rb +6 -0
  54. data/app/models/abstractor/abstractor_subject_group_member.rb +6 -0
  55. data/app/models/abstractor/abstractor_subject_relation.rb +6 -0
  56. data/app/models/abstractor/abstractor_suggestion.rb +6 -0
  57. data/app/models/abstractor/abstractor_suggestion_object_value.rb +6 -0
  58. data/app/models/abstractor/abstractor_suggestion_source.rb +6 -0
  59. data/app/models/abstractor/abstractor_suggestion_status.rb +6 -0
  60. data/app/views/abstractor/abstractor_abstraction_groups/_form.html.haml +10 -0
  61. data/app/views/abstractor/abstractor_abstraction_groups/edit.html.haml +1 -0
  62. data/app/views/abstractor/abstractor_abstractions/_fields.html.haml +63 -0
  63. data/app/views/abstractor/abstractor_abstractions/_list.html.haml +45 -0
  64. data/app/views/abstractor/abstractor_abstractions/edit.html.haml +53 -0
  65. data/app/views/abstractor/abstractor_abstractions/show.html.haml +1 -0
  66. data/app/views/abstractor/shared/_error_messages.html.haml +5 -0
  67. data/config/cucumber.yml +8 -0
  68. data/config/routes.rb +7 -0
  69. data/db/migrate/20131227205140_create_abstractor_object_types.rb +10 -0
  70. data/db/migrate/20131227205219_create_abstractor_object_values.rb +10 -0
  71. data/db/migrate/20131227205256_create_abstractor_object_value_variants.rb +11 -0
  72. data/db/migrate/20131227205320_create_abstractor_relation_types.rb +10 -0
  73. data/db/migrate/20131227205354_create_abstractor_rule_types.rb +11 -0
  74. data/db/migrate/20131227205432_create_abstractor_abstraction_schemas.rb +13 -0
  75. data/db/migrate/20131227205456_create_abstractor_abstraction_schema_object_values.rb +10 -0
  76. data/db/migrate/20131227205529_create_abstractor_abstraction_schema_predicate_variants.rb +11 -0
  77. data/db/migrate/20131227205610_create_abstractor_abstraction_schema_relations.rb +11 -0
  78. data/db/migrate/20131227205652_create_abstractor_subjects.rb +12 -0
  79. data/db/migrate/20131227205732_create_abstractor_subject_relations.rb +11 -0
  80. data/db/migrate/20131227205831_create_abstractor_abstraction_sources.rb +11 -0
  81. data/db/migrate/20131227210211_create_abstractor_subject_groups.rb +10 -0
  82. data/db/migrate/20131227210244_create_abstractor_subject_group_members.rb +11 -0
  83. data/db/migrate/20131227210350_create_abstractor_abstraction_groups.rb +12 -0
  84. data/db/migrate/20131227210353_create_abstractor_abstraction_group_members.rb +11 -0
  85. data/db/migrate/20131227211050_create_abstractor_suggestion_statuses.rb +10 -0
  86. data/db/migrate/20131227211303_create_abstractor_abstractions.rb +15 -0
  87. data/db/migrate/20131227213427_create_abstractor_suggestions.rb +14 -0
  88. data/db/migrate/20131228041944_create_abstractor_suggestion_object_values.rb +11 -0
  89. data/db/migrate/20131228041945_create_abstractor_suggestion_sources.rb +16 -0
  90. data/db/seeds.rb +0 -0
  91. data/lib/abstractor.rb +8 -0
  92. data/lib/abstractor/abstractable.rb +190 -0
  93. data/lib/abstractor/core_ext/string.rb +99 -0
  94. data/lib/abstractor/engine.rb +14 -0
  95. data/lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb +37 -0
  96. data/lib/abstractor/methods/controllers/abstractor_abstractions_controller.rb +42 -0
  97. data/lib/abstractor/methods/controllers/abstractor_suggestions_controller.rb +28 -0
  98. data/lib/abstractor/methods/models/abstractor_abstraction.rb +65 -0
  99. data/lib/abstractor/methods/models/abstractor_abstraction_group.rb +37 -0
  100. data/lib/abstractor/methods/models/abstractor_abstraction_group_member.rb +17 -0
  101. data/lib/abstractor/methods/models/abstractor_abstraction_schema.rb +27 -0
  102. data/lib/abstractor/methods/models/abstractor_abstraction_schema_object_value.rb +17 -0
  103. data/lib/abstractor/methods/models/abstractor_abstraction_schema_predicate_variant.rb +16 -0
  104. data/lib/abstractor/methods/models/abstractor_abstraction_schema_relation.rb +18 -0
  105. data/lib/abstractor/methods/models/abstractor_abstraction_source.rb +29 -0
  106. data/lib/abstractor/methods/models/abstractor_object_type.rb +16 -0
  107. data/lib/abstractor/methods/models/abstractor_object_value.rb +24 -0
  108. data/lib/abstractor/methods/models/abstractor_object_value_variant.rb +16 -0
  109. data/lib/abstractor/methods/models/abstractor_relation_type.rb +16 -0
  110. data/lib/abstractor/methods/models/abstractor_rule_type.rb +17 -0
  111. data/lib/abstractor/methods/models/abstractor_subject.rb +258 -0
  112. data/lib/abstractor/methods/models/abstractor_subject_group.rb +19 -0
  113. data/lib/abstractor/methods/models/abstractor_subject_group_member.rb +17 -0
  114. data/lib/abstractor/methods/models/abstractor_subject_relation.rb +18 -0
  115. data/lib/abstractor/methods/models/abstractor_suggestion.rb +88 -0
  116. data/lib/abstractor/methods/models/abstractor_suggestion_object_value.rb +17 -0
  117. data/lib/abstractor/methods/models/abstractor_suggestion_source.rb +17 -0
  118. data/lib/abstractor/methods/models/abstractor_suggestion_status.rb +29 -0
  119. data/lib/abstractor/methods/models/soft_delete.rb +35 -0
  120. data/lib/abstractor/negation_detection.rb +43 -0
  121. data/lib/abstractor/parser.rb +76 -0
  122. data/lib/abstractor/setup.rb +24 -0
  123. data/lib/abstractor/user_interface.rb +40 -0
  124. data/lib/abstractor/utility.rb +8 -0
  125. data/lib/abstractor/version.rb +3 -0
  126. data/lib/generators/abstractor/install/install_generator.rb +118 -0
  127. data/lib/generators/abstractor/install/templates/controllers/abstractor_abstraction_groups_controller.rb +16 -0
  128. data/lib/generators/abstractor/install/templates/controllers/abstractor_abstractions_controller.rb +24 -0
  129. data/lib/generators/abstractor/install/templates/controllers/abstractor_suggestions_controller.rb +12 -0
  130. data/lib/generators/abstractor/install/templates/dictionaries.yml +235 -0
  131. data/lib/generators/abstractor/install/templates/helpers/abstractions_helper.rb +9 -0
  132. data/lib/generators/abstractor/install/templates/models/abstractor_abstraction.rb +9 -0
  133. data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_group.rb +9 -0
  134. data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_group_member.rb +9 -0
  135. data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_schema.rb +9 -0
  136. data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_schema_object_value.rb +9 -0
  137. data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_schema_predicate_variant.rb +9 -0
  138. data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_schema_relation.rb +9 -0
  139. data/lib/generators/abstractor/install/templates/models/abstractor_abstraction_source.rb +9 -0
  140. data/lib/generators/abstractor/install/templates/models/abstractor_object_type.rb +9 -0
  141. data/lib/generators/abstractor/install/templates/models/abstractor_object_value.rb +9 -0
  142. data/lib/generators/abstractor/install/templates/models/abstractor_object_value_variant.rb +9 -0
  143. data/lib/generators/abstractor/install/templates/models/abstractor_relation_type.rb +9 -0
  144. data/lib/generators/abstractor/install/templates/models/abstractor_rule_type.rb +9 -0
  145. data/lib/generators/abstractor/install/templates/models/abstractor_subject.rb +9 -0
  146. data/lib/generators/abstractor/install/templates/models/abstractor_subject_group.rb +9 -0
  147. data/lib/generators/abstractor/install/templates/models/abstractor_subject_group_member.rb +9 -0
  148. data/lib/generators/abstractor/install/templates/models/abstractor_subject_relation.rb +9 -0
  149. data/lib/generators/abstractor/install/templates/models/abstractor_suggestion.rb +9 -0
  150. data/lib/generators/abstractor/install/templates/models/abstractor_suggestion_object_value.rb +9 -0
  151. data/lib/generators/abstractor/install/templates/models/abstractor_suggestion_source.rb +9 -0
  152. data/lib/generators/abstractor/install/templates/models/abstractor_suggestion_status.rb +9 -0
  153. data/lib/lingscope/build.xml +74 -0
  154. data/lib/lingscope/build/built-jar.properties +4 -0
  155. data/lib/lingscope/build/classes/lingscope/algorithms/AbnerTokenizer.class +0 -0
  156. data/lib/lingscope/build/classes/lingscope/algorithms/AnnotationComparer.class +0 -0
  157. data/lib/lingscope/build/classes/lingscope/algorithms/Annotator.class +0 -0
  158. data/lib/lingscope/build/classes/lingscope/algorithms/BaselineAnnotator.class +0 -0
  159. data/lib/lingscope/build/classes/lingscope/algorithms/BaselineCueAnnotator.class +0 -0
  160. data/lib/lingscope/build/classes/lingscope/algorithms/BaselineScopeAnnotator.class +0 -0
  161. data/lib/lingscope/build/classes/lingscope/algorithms/CrfAnnotator.class +0 -0
  162. data/lib/lingscope/build/classes/lingscope/algorithms/NegexAnnotator.class +0 -0
  163. data/lib/lingscope/build/classes/lingscope/algorithms/NegexCueAnnotator.class +0 -0
  164. data/lib/lingscope/build/classes/lingscope/algorithms/NegexScopeAnnotator.class +0 -0
  165. data/lib/lingscope/build/classes/lingscope/algorithms/PosTagger.class +0 -0
  166. data/lib/lingscope/build/classes/lingscope/algorithms/negex/GenNegEx.class +0 -0
  167. data/lib/lingscope/build/classes/lingscope/algorithms/negex/Sorter.class +0 -0
  168. data/lib/lingscope/build/classes/lingscope/drivers/AnnotatedFilesMerger.class +0 -0
  169. data/lib/lingscope/build/classes/lingscope/drivers/AnnotationComparerDriver.class +0 -0
  170. data/lib/lingscope/build/classes/lingscope/drivers/BaselineDriver.class +0 -0
  171. data/lib/lingscope/build/classes/lingscope/drivers/CrfDriver.class +0 -0
  172. data/lib/lingscope/build/classes/lingscope/drivers/CueAndPosFilesMerger.class +0 -0
  173. data/lib/lingscope/build/classes/lingscope/drivers/ModelTrainer.class +0 -0
  174. data/lib/lingscope/build/classes/lingscope/drivers/NegexDriver.class +0 -0
  175. data/lib/lingscope/build/classes/lingscope/drivers/PosTaggerDriver.class +0 -0
  176. data/lib/lingscope/build/classes/lingscope/drivers/SentencePosTagger.class +0 -0
  177. data/lib/lingscope/build/classes/lingscope/drivers/SentenceTagger.class +0 -0
  178. data/lib/lingscope/build/classes/lingscope/io/AnnotatedSentencesIO.class +0 -0
  179. data/lib/lingscope/build/classes/lingscope/structures/AnnotatedSentence.class +0 -0
  180. data/lib/lingscope/dist/README.TXT +32 -0
  181. data/lib/lingscope/dist/javadoc/allclasses-frame.html +80 -0
  182. data/lib/lingscope/dist/javadoc/allclasses-noframe.html +80 -0
  183. data/lib/lingscope/dist/javadoc/constant-values.html +199 -0
  184. data/lib/lingscope/dist/javadoc/deprecated-list.html +147 -0
  185. data/lib/lingscope/dist/javadoc/help-doc.html +224 -0
  186. data/lib/lingscope/dist/javadoc/index-files/index-1.html +188 -0
  187. data/lib/lingscope/dist/javadoc/index-files/index-10.html +149 -0
  188. data/lib/lingscope/dist/javadoc/index-files/index-11.html +158 -0
  189. data/lib/lingscope/dist/javadoc/index-files/index-12.html +157 -0
  190. data/lib/lingscope/dist/javadoc/index-files/index-13.html +177 -0
  191. data/lib/lingscope/dist/javadoc/index-files/index-14.html +155 -0
  192. data/lib/lingscope/dist/javadoc/index-files/index-15.html +152 -0
  193. data/lib/lingscope/dist/javadoc/index-files/index-16.html +146 -0
  194. data/lib/lingscope/dist/javadoc/index-files/index-2.html +158 -0
  195. data/lib/lingscope/dist/javadoc/index-files/index-3.html +165 -0
  196. data/lib/lingscope/dist/javadoc/index-files/index-4.html +146 -0
  197. data/lib/lingscope/dist/javadoc/index-files/index-5.html +219 -0
  198. data/lib/lingscope/dist/javadoc/index-files/index-6.html +149 -0
  199. data/lib/lingscope/dist/javadoc/index-files/index-7.html +155 -0
  200. data/lib/lingscope/dist/javadoc/index-files/index-8.html +185 -0
  201. data/lib/lingscope/dist/javadoc/index-files/index-9.html +164 -0
  202. data/lib/lingscope/dist/javadoc/index.html +74 -0
  203. data/lib/lingscope/dist/javadoc/lingscope/algorithms/AbnerTokenizer.html +280 -0
  204. data/lib/lingscope/dist/javadoc/lingscope/algorithms/AnnotationComparer.html +526 -0
  205. data/lib/lingscope/dist/javadoc/lingscope/algorithms/Annotator.html +401 -0
  206. data/lib/lingscope/dist/javadoc/lingscope/algorithms/BaselineAnnotator.html +375 -0
  207. data/lib/lingscope/dist/javadoc/lingscope/algorithms/BaselineCueAnnotator.html +309 -0
  208. data/lib/lingscope/dist/javadoc/lingscope/algorithms/BaselineScopeAnnotator.html +340 -0
  209. data/lib/lingscope/dist/javadoc/lingscope/algorithms/CrfAnnotator.html +340 -0
  210. data/lib/lingscope/dist/javadoc/lingscope/algorithms/NegexAnnotator.html +364 -0
  211. data/lib/lingscope/dist/javadoc/lingscope/algorithms/NegexCueAnnotator.html +309 -0
  212. data/lib/lingscope/dist/javadoc/lingscope/algorithms/NegexScopeAnnotator.html +309 -0
  213. data/lib/lingscope/dist/javadoc/lingscope/algorithms/PosTagger.html +268 -0
  214. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/AbnerTokenizer.html +145 -0
  215. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/AnnotationComparer.html +145 -0
  216. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/Annotator.html +299 -0
  217. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/BaselineAnnotator.html +189 -0
  218. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/BaselineCueAnnotator.html +145 -0
  219. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/BaselineScopeAnnotator.html +145 -0
  220. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/CrfAnnotator.html +145 -0
  221. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/NegexAnnotator.html +189 -0
  222. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/NegexCueAnnotator.html +145 -0
  223. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/NegexScopeAnnotator.html +145 -0
  224. data/lib/lingscope/dist/javadoc/lingscope/algorithms/class-use/PosTagger.html +145 -0
  225. data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/GenNegEx.html +369 -0
  226. data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/Sorter.html +253 -0
  227. data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/class-use/GenNegEx.html +181 -0
  228. data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/class-use/Sorter.html +145 -0
  229. data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/package-frame.html +35 -0
  230. data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/package-summary.html +165 -0
  231. data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/package-tree.html +154 -0
  232. data/lib/lingscope/dist/javadoc/lingscope/algorithms/negex/package-use.html +174 -0
  233. data/lib/lingscope/dist/javadoc/lingscope/algorithms/package-frame.html +53 -0
  234. data/lib/lingscope/dist/javadoc/lingscope/algorithms/package-summary.html +198 -0
  235. data/lib/lingscope/dist/javadoc/lingscope/algorithms/package-tree.html +160 -0
  236. data/lib/lingscope/dist/javadoc/lingscope/algorithms/package-use.html +202 -0
  237. data/lib/lingscope/dist/javadoc/lingscope/drivers/AnnotatedFilesMerger.html +284 -0
  238. data/lib/lingscope/dist/javadoc/lingscope/drivers/AnnotationComparerDriver.html +258 -0
  239. data/lib/lingscope/dist/javadoc/lingscope/drivers/BaselineDriver.html +260 -0
  240. data/lib/lingscope/dist/javadoc/lingscope/drivers/CrfDriver.html +262 -0
  241. data/lib/lingscope/dist/javadoc/lingscope/drivers/CueAndPosFilesMerger.html +310 -0
  242. data/lib/lingscope/dist/javadoc/lingscope/drivers/ModelTrainer.html +281 -0
  243. data/lib/lingscope/dist/javadoc/lingscope/drivers/NegexDriver.html +262 -0
  244. data/lib/lingscope/dist/javadoc/lingscope/drivers/PosTaggerDriver.html +289 -0
  245. data/lib/lingscope/dist/javadoc/lingscope/drivers/SentencePosTagger.html +313 -0
  246. data/lib/lingscope/dist/javadoc/lingscope/drivers/SentenceTagger.html +512 -0
  247. data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/AnnotatedFilesMerger.html +145 -0
  248. data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/AnnotationComparerDriver.html +145 -0
  249. data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/BaselineDriver.html +145 -0
  250. data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/CrfDriver.html +145 -0
  251. data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/CueAndPosFilesMerger.html +145 -0
  252. data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/ModelTrainer.html +145 -0
  253. data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/NegexDriver.html +145 -0
  254. data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/PosTaggerDriver.html +145 -0
  255. data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/SentencePosTagger.html +145 -0
  256. data/lib/lingscope/dist/javadoc/lingscope/drivers/class-use/SentenceTagger.html +145 -0
  257. data/lib/lingscope/dist/javadoc/lingscope/drivers/package-frame.html +51 -0
  258. data/lib/lingscope/dist/javadoc/lingscope/drivers/package-summary.html +195 -0
  259. data/lib/lingscope/dist/javadoc/lingscope/drivers/package-tree.html +154 -0
  260. data/lib/lingscope/dist/javadoc/lingscope/drivers/package-use.html +145 -0
  261. data/lib/lingscope/dist/javadoc/lingscope/io/AnnotatedSentencesIO.html +285 -0
  262. data/lib/lingscope/dist/javadoc/lingscope/io/class-use/AnnotatedSentencesIO.html +145 -0
  263. data/lib/lingscope/dist/javadoc/lingscope/io/package-frame.html +33 -0
  264. data/lib/lingscope/dist/javadoc/lingscope/io/package-summary.html +158 -0
  265. data/lib/lingscope/dist/javadoc/lingscope/io/package-tree.html +154 -0
  266. data/lib/lingscope/dist/javadoc/lingscope/io/package-use.html +145 -0
  267. data/lib/lingscope/dist/javadoc/lingscope/structures/AnnotatedSentence.html +425 -0
  268. data/lib/lingscope/dist/javadoc/lingscope/structures/class-use/AnnotatedSentence.html +423 -0
  269. data/lib/lingscope/dist/javadoc/lingscope/structures/package-frame.html +33 -0
  270. data/lib/lingscope/dist/javadoc/lingscope/structures/package-summary.html +158 -0
  271. data/lib/lingscope/dist/javadoc/lingscope/structures/package-tree.html +154 -0
  272. data/lib/lingscope/dist/javadoc/lingscope/structures/package-use.html +209 -0
  273. data/lib/lingscope/dist/javadoc/overview-frame.html +51 -0
  274. data/lib/lingscope/dist/javadoc/overview-summary.html +168 -0
  275. data/lib/lingscope/dist/javadoc/overview-tree.html +159 -0
  276. data/lib/lingscope/dist/javadoc/package-list +5 -0
  277. data/lib/lingscope/dist/javadoc/resources/inherit.gif +0 -0
  278. data/lib/lingscope/dist/javadoc/stylesheet.css +29 -0
  279. data/lib/lingscope/dist/lib/abner.jar +0 -0
  280. data/lib/lingscope/dist/lib/commons-lang-2.4.jar +0 -0
  281. data/lib/lingscope/dist/lib/java_utils.jar +0 -0
  282. data/lib/lingscope/dist/lib/sptoolkit.jar +0 -0
  283. data/lib/lingscope/dist/lib/stanford-postagger.jar +0 -0
  284. data/lib/lingscope/dist/lingscope.jar +0 -0
  285. data/lib/lingscope/lingscope.zip +0 -0
  286. data/lib/lingscope/manifest.mf +3 -0
  287. data/lib/lingscope/nbproject/build-impl.xml +1338 -0
  288. data/lib/lingscope/nbproject/genfiles.properties +8 -0
  289. data/lib/lingscope/nbproject/private/config.properties +0 -0
  290. data/lib/lingscope/nbproject/private/private.properties +10 -0
  291. data/lib/lingscope/nbproject/private/private.xml +5 -0
  292. data/lib/lingscope/nbproject/project.properties +85 -0
  293. data/lib/lingscope/nbproject/project.xml +15 -0
  294. data/lib/lingscope/negation_models.zip +0 -0
  295. data/lib/lingscope/negation_models/baseline_cue_all_both.model +49 -0
  296. data/lib/lingscope/negation_models/baseline_cue_all_clinical.model +19 -0
  297. data/lib/lingscope/negation_models/crf_cue_all_both.model +0 -0
  298. data/lib/lingscope/negation_models/crf_cue_all_clinical.model +0 -0
  299. data/lib/lingscope/negation_models/crf_scope_cue_crf_all_both.model +0 -0
  300. data/lib/lingscope/negation_models/crf_scope_cue_crf_all_clinical.model +0 -0
  301. data/lib/lingscope/negation_models/crf_scope_cue_regex_all_both.model +0 -0
  302. data/lib/lingscope/negation_models/crf_scope_cue_regex_all_clinical.model +0 -0
  303. data/lib/lingscope/negation_models/crf_scope_words_all_both.model +0 -0
  304. data/lib/lingscope/negation_models/crf_scope_words_all_clinical.model +0 -0
  305. data/lib/lingscope/negation_models/crf_scope_words_crf_all_both.model +0 -0
  306. data/lib/lingscope/negation_models/crf_scope_words_crf_all_clinical.model +0 -0
  307. data/lib/lingscope/negation_models/crf_scope_words_regex_all_both.model +0 -0
  308. data/lib/lingscope/negation_models/crf_scope_words_regex_all_clinical.model +0 -0
  309. data/lib/lingscope/src/lingscope/algorithms/AbnerTokenizer.java +58 -0
  310. data/lib/lingscope/src/lingscope/algorithms/AnnotationComparer.java +207 -0
  311. data/lib/lingscope/src/lingscope/algorithms/Annotator.java +51 -0
  312. data/lib/lingscope/src/lingscope/algorithms/BaselineAnnotator.java +80 -0
  313. data/lib/lingscope/src/lingscope/algorithms/BaselineCueAnnotator.java +84 -0
  314. data/lib/lingscope/src/lingscope/algorithms/BaselineScopeAnnotator.java +101 -0
  315. data/lib/lingscope/src/lingscope/algorithms/CrfAnnotator.java +45 -0
  316. data/lib/lingscope/src/lingscope/algorithms/NegexAnnotator.java +52 -0
  317. data/lib/lingscope/src/lingscope/algorithms/NegexCueAnnotator.java +26 -0
  318. data/lib/lingscope/src/lingscope/algorithms/NegexScopeAnnotator.java +26 -0
  319. data/lib/lingscope/src/lingscope/algorithms/PosTagger.java +54 -0
  320. data/lib/lingscope/src/lingscope/algorithms/negex/GenNegEx.java +530 -0
  321. data/lib/lingscope/src/lingscope/algorithms/negex/Sorter.java +36 -0
  322. data/lib/lingscope/src/lingscope/drivers/AnnotatedFilesMerger.java +61 -0
  323. data/lib/lingscope/src/lingscope/drivers/AnnotationComparerDriver.java +22 -0
  324. data/lib/lingscope/src/lingscope/drivers/BaselineDriver.java +45 -0
  325. data/lib/lingscope/src/lingscope/drivers/CrfDriver.java +31 -0
  326. data/lib/lingscope/src/lingscope/drivers/CueAndPosFilesMerger.java +86 -0
  327. data/lib/lingscope/src/lingscope/drivers/ModelTrainer.java +39 -0
  328. data/lib/lingscope/src/lingscope/drivers/NegexDriver.java +32 -0
  329. data/lib/lingscope/src/lingscope/drivers/PosTaggerDriver.java +62 -0
  330. data/lib/lingscope/src/lingscope/drivers/SentencePosTagger.java +89 -0
  331. data/lib/lingscope/src/lingscope/drivers/SentenceTagger.java +158 -0
  332. data/lib/lingscope/src/lingscope/io/AnnotatedSentencesIO.java +53 -0
  333. data/lib/lingscope/src/lingscope/structures/AnnotatedSentence.java +105 -0
  334. data/lib/setup/data/ICD-O-3_CSV-metadata/Morphenglish.csv +1 -0
  335. data/lib/setup/data/ICD-O-3_CSV-metadata/Morphenglish.txt +2273 -0
  336. data/lib/setup/data/ICD-O-3_CSV-metadata/Topoenglish.csv +1 -0
  337. data/lib/setup/data/ICD-O-3_CSV-metadata/Topoenglish.txt +1342 -0
  338. data/lib/setup/data/ICD-O-3_CSV-metadata/icd-o3 readme.txt +21 -0
  339. data/lib/setup/data/custom_site_synonyms.csv +1 -0
  340. data/lib/setup/data/diagnosis_categorizations.csv +1 -0
  341. data/lib/setup/data/high_level_primary_cns_diagnosis_categorizations.yml +597 -0
  342. data/lib/setup/data/icdo3_sites_with_laterality.txt +11 -0
  343. data/lib/setup/data/site_site_categories.txt +28 -0
  344. data/lib/tasks/abstractor_tasks.rake +22 -0
  345. data/lib/tasks/cucumber.rake +65 -0
  346. metadata +754 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MmNiYTNjYzA3NmU2MzI5M2FkYTE3MzMwODRmODQ3MjIwNWNmNWY1Zg==
5
+ data.tar.gz: !binary |-
6
+ ZmQ3ZmYwNjhjNzkwNjgyNDA1MGRjZTM1YmE0ZWU3NmU3YjA2ZGY3Mg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZmM3YmVmN2QyYjVkZWNlYzk0MDMzZTM4Nzc5OTk3ZTUzMDg0YjkzMzBkZTY1
10
+ ZWE3NjViZWI4MDYzODAyMzc0ZjFhMjVjYjdlMmNmMDQ1MTk0NmZmODQzMjY5
11
+ NWFlNTVjNmJkZmQzMTI2OWMyNTMyYjM1N2ZjMWVhZmQzMTQ2YTk=
12
+ data.tar.gz: !binary |-
13
+ N2NmYjI5ZjY1ZjZhMmEwOTI4MWE3YTYxNzJjMjE2YjY5ZGQ5NDM1ODZhNmFj
14
+ MGQ4MzJlMDBjYmZkMGY4NzNlNGNiOTcwNWY4NmZkOWQ5YWU5YzRhZTAzYjcw
15
+ ODdmYTA0ZjMwOTA5ZTRlYjNlOTQ5ZjkyZDk0NDY1Njc4NDJhMGM=
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 Michael Gurley, Yulia A Bushmanova
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ Abstractor
2
+ ====
3
+
4
+ Abstractor is a Rails engine Gem that provides functionality for:
5
+
6
+ * The definition and abstraction of discrete data points from narrative text via natural language processing (NLP).
7
+ * A web user interface for the presentation of the NLP-derived abstracted discrete data points for confirmation/revision.
8
+
9
+ Reader's note: this README uses [YARD][] markup to provide links to
10
+ Abstractor's API documentation. If you aren't already, consider reading it
11
+ on [rubydoc.info][] so that the links will be followable.
12
+
13
+ [YARD]: http://yardoc.org/
14
+ [rubydoc.info]: http://rubydoc.info/github/NUBIC/abstractor/master/file/README.md
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ require 'cucumber/rake/task'
5
+ require 'rspec/core/rake_task'
6
+ require 'rubygems/package_task'
7
+ require 'nubic/gem_tasks'
8
+ end
9
+
10
+ gemspec = eval(File.read('abstractor.gemspec'), binding, 'abstractor.gemspec')
11
+ Gem::PackageTask.new(gemspec).define
12
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
13
+ $:.unshift File.join(File.dirname(__FILE__), 'spec','support')
14
+ load 'rails/tasks/engine.rake' if File.exists?(APP_RAKEFILE)
15
+ load 'lib/tasks/abstractor_tasks.rake'
16
+ load 'test/lib/tasks/abstractor_test_tasks.rake'
17
+ RSpec::Core::RakeTask.new(:spec)
18
+ task :default => :spec
19
+
20
+ namespace :cucumber do
21
+ Cucumber::Rake::Task.new(:wip, 'Run features that are being worked on') do |t|
22
+ t.profile = 'wip'
23
+ end
24
+
25
+ Cucumber::Rake::Task.new(:features) do |t|
26
+ t.cucumber_opts = "features --format pretty"
27
+ end
28
+ end
29
+
30
+ task :cucumber => 'cucumber:features'
31
+ Nubic::GemTasks::DeployGemTask.new("pkg/#{gemspec.file_name}")
32
+ task "deploy:gem" => :repackage
33
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,89 @@
1
+ Abstractor = {};
2
+
3
+ Abstractor.AbstractionUI = function(){
4
+ $(document).on('click', '.abstractor_abstraction_value a.edit_link', function(e){
5
+ e.preventDefault();
6
+ parent_div = $(this).closest('.abstractor_abstraction');
7
+ parent_div.load($(this).attr('href'), function(){
8
+ parent_div.find('.combobox').combobox({watermark:'a value'});
9
+ parent_div.find('input[type="submit"], button, a.button').button();
10
+ });
11
+ parent_div.addClass('highlighted');
12
+ //parent_div.siblings('.abstractor_abstraction').block({ message: null, overlayCSS: { opacity: .2 }});
13
+ });
14
+ $(document).on('ajax:success', 'form.edit_abstractor_abstraction', function(e, data, status, xhr){
15
+ parent_div = $(this).closest('.abstractor_abstraction');
16
+ parent_div.html(xhr.responseText);
17
+ //parent_div.siblings('.abstractor_abstraction').unblock();
18
+ parent_div.removeClass('highlighted');
19
+ });
20
+ $(document).on('click', ".edit_abstractor_abstraction input[type='radio']", function(){
21
+ $(this).siblings("input[type='checkbox']").prop('checked',false);
22
+ });
23
+ $(document).on('click', ".edit_abstractor_abstraction input[type='checkbox']", function(){
24
+ $(this).siblings("input[type='checkbox']").prop('checked',false);
25
+ $(this).siblings("input[type='text']").prop('value','');
26
+ var autocompleters = $(this).siblings('select.combobox');
27
+ autocompleters.combobox('setValue', '');
28
+ autocompleters.change();
29
+
30
+ $.each($(this).siblings("input[type='radio']"), function(){
31
+ if ($(this).prop('value') === '') {
32
+ $(this).prop('checked',true);
33
+ } else {
34
+ $(this).prop('checked',false);
35
+ }
36
+ });
37
+ });
38
+ $(document).on('change', '.edit_abstractor_abstraction select.combobox', function () {
39
+ if ($(this).find('option:selected').prop('value').length){
40
+ $(this).siblings("input[type='checkbox']").prop('checked',false);
41
+ }
42
+ });
43
+ $(document).on('change', ".edit_abstractor_abstraction input[type='text']", function(){
44
+ $(this).siblings("input[type='checkbox']").prop('checked',false);
45
+ });
46
+ $(document.body).append('<div id="abstractor_abstraction_dialog_tooltip"></div>');
47
+
48
+ $(document).on('click','.abstractor_abstraction_source_tooltip_img', function (evt) {
49
+ var target = $(this).attr('rel'),
50
+ html = $(target).html(),
51
+ title = $(this).attr('title');
52
+
53
+
54
+ evt.preventDefault();
55
+ $('#abstractor_abstraction_dialog_tooltip').html(html);
56
+ $('#abstractor_abstraction_dialog_tooltip').dialog('option', 'title', title);
57
+ $('#abstractor_abstraction_dialog_tooltip').dialog('option', 'width', ($(window).width() * 0.80));
58
+ $('#abstractor_abstraction_dialog_tooltip').dialog('open');
59
+ });
60
+
61
+ $('#abstractor_abstraction_dialog_tooltip').dialog({
62
+ maxHeight: 400,
63
+ autoOpen: false,
64
+ width: 600,
65
+ zIndex: 40000,
66
+ dialogClass: "ui-dialog_abstractor"
67
+ });
68
+ };
69
+
70
+ Abstractor.AbstractionSuggestionUI = function(){
71
+ $(document).on('change', 'form.edit_abstractor_suggestion select', function() {
72
+ $(this).closest('form').submit();
73
+ });
74
+ $(document).on('ajax:success', 'form.edit_abstractor_suggestion', function(e, data, status, xhr){
75
+ $(this).closest('.abstractor_abstraction').html(xhr.responseText);
76
+ });
77
+ };
78
+
79
+ Abstractor.AbstractionGroupUI = function(){
80
+ $(document).on('ajax:success', '.abstractor_abstraction_group .delete_link', function(e, data, status, xhr){
81
+ parent_div = $(this).closest('.abstractor_abstraction_group');
82
+ parent_div.html(xhr.responseText);
83
+ });
84
+
85
+ $(document).on('ajax:success', '.abstractor_subject_groups_container .add_link', function(e, data, status, xhr){
86
+ parent_div = $(this).closest('.abstractor_subject_groups_container');
87
+ parent_div.find('.abstractor_subject_groups').append(xhr.responseText);
88
+ });
89
+ };
@@ -0,0 +1,21 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require jquery.ui.widget
16
+ //= require jquery.ui.autocomplete
17
+ //= require jquery.ui.datepicker
18
+ //= require jquery.ui.button
19
+ //= require jquery.ui.dialog
20
+
21
+ //= require_tree .
@@ -0,0 +1,301 @@
1
+ // courtesy of https://github.com/garyzhu/jquery.ui.combobox/blob/master/jquery.ui.combobox.js
2
+ // more courtesy https://github.com/garyzhu/jquery.ui.combobox/commit/65433ee5af6e9b87b594e5bb5c4b16b030806e24
3
+ /*
4
+ * Combobox widget. This widget extends the jQuery UI autocomplete widget.
5
+ *
6
+ * usage: $("#select_element").combox();
7
+ * $("#input_element").combox( {minLength: 2, delay: 200, source: anArray} );
8
+ *
9
+ * For select elements, the source list is automatically generated from the option elements.
10
+ *
11
+ * To configure a label decorator (i.e. "[admin]"), set the decoratorField when you
12
+ * initialize the combobox. The field corresponds to the object field, if the source is
13
+ * an array of objects. Or it's the attribute in <option> if the source is a select drop-down menu.
14
+ */
15
+
16
+ (function($) {
17
+ $.widget("ui.combobox", $.ui.autocomplete, {
18
+ options: {
19
+ /* override default values here */
20
+ minLength: 2,
21
+ /* the argument to pass to ajax to get the complete list */
22
+ ajaxGetAll: {
23
+ get: "all"
24
+ },
25
+ /* you can specify the field to use as a label decorator,
26
+ * it's appended to the end of the label and is excluded
27
+ * from pattern matching.
28
+ */
29
+ decoratorField: null
30
+ },
31
+
32
+ _create: function() {
33
+ if (this.element.is("SELECT")) {
34
+ this._selectInit();
35
+ return;
36
+ }
37
+ $.ui.autocomplete.prototype._create.call(this);
38
+ var input = this.element,
39
+ watermark = ('Search for ' + this.options.watermark); // custom watermark
40
+
41
+ // custom part - setting and removing watermark
42
+ function clearWatermark () {
43
+ if (input.val() === watermark) {
44
+ input.val('');
45
+ }
46
+ };
47
+
48
+ function setWatermark () {
49
+ input.val(watermark);
50
+ input.bind('focus', clearWatermark);
51
+ };
52
+
53
+ if (input.not("SELECT")) {
54
+ input.blur( function (e) {
55
+ if ($(this).val() === '') {
56
+ input.val(watermark);
57
+ }
58
+ e.preventDefault();
59
+ return false;
60
+ });
61
+
62
+ $(document).ready(function () {
63
+ if ($(input).val() === '') {
64
+ setWatermark();
65
+ }
66
+ });
67
+ }
68
+ // end of custom part
69
+
70
+ input.addClass("ui-widget ui-widget-content ui-corner-left").click(function() {
71
+ this.select();
72
+ });
73
+
74
+ this.button = $("<button type='button'>&nbsp;</button>")
75
+ .attr("tabIndex", -1)
76
+ .attr("title", "Show All Items")
77
+ .insertAfter(input).button({
78
+ disabled: true,
79
+ // to be enabled when the menu is ready.
80
+ icons: {
81
+ primary: "ui-icon-triangle-1-s"
82
+ },
83
+ text: false
84
+ })
85
+ .removeClass("ui-corner-all")
86
+ .addClass("ui-corner-right ui-button-icon")
87
+ .click(function(event) {
88
+ // when user clicks the show all button, we display the cached full menu
89
+ var data = input.data("ui-combobox");
90
+ clearTimeout(data.closing);
91
+ if (!input.isFullMenu) {
92
+ data._swapMenu();
93
+ }
94
+ /* input/select that are initially hidden (display=none, i.e. second level menus),
95
+ will not have position cordinates until they are visible. */
96
+ input.combobox("widget").css("display", "block").position($.extend({
97
+ of: input
98
+ }, data.options.position));
99
+ input.focus();
100
+ data._trigger("open");
101
+ // containers such as jquery-ui dialog box will adjust it's zIndex to overlay above other elements.
102
+ // this becomes a problem if the combobox is inside of a dialog box, the full drop down will show
103
+ // under the dialog box.
104
+ if (input.combobox("widget").zIndex() <= input.parent().zIndex()) {
105
+ input.combobox("widget").zIndex(input.parent().zIndex() + 1);
106
+ }
107
+ });
108
+
109
+ /* to better handle large lists, put in a queue and process sequentially */
110
+ $(document).queue(function() {
111
+ var data = input.data("ui-combobox");
112
+ if ($.isArray(data.options.source)) {
113
+ $.ui.combobox.prototype._renderFullMenu.call(data, data.options.source);
114
+ } else if (typeof data.options.source === "string") {
115
+ $.getJSON(data.options.source, data.options.ajaxGetAll, function(source) {
116
+ $.ui.combobox.prototype._renderFullMenu.call(data, source);
117
+ });
118
+ } else {
119
+ $.ui.combobox.prototype._renderFullMenu.call(data, data.source());
120
+ }
121
+ });
122
+ },
123
+
124
+ /* initialize the full list of items, this menu will be reused whenever the user clicks the show all button */
125
+ _renderFullMenu: function(source) {
126
+ var self = this,
127
+ input = this.element,
128
+ ul = input.data("ui-combobox").menu.element,
129
+ lis = [];
130
+ source = this._normalize(source);
131
+ input.data("ui-combobox").menuAll = input.data("ui-combobox").menu.element.clone(true).appendTo("body")[0];
132
+ for (var i = 0; i < source.length; i++) {
133
+ var item = source[i],
134
+ label = item.label;
135
+ if (this.options.decoratorField != null) {
136
+ var d = item[this.options.decoratorField] || (item.option && $(item.option).attr(this.options.decoratorField));
137
+ if (d != undefined) label = label + " " + d;
138
+ }
139
+ lis[i] = "<li class=\"ui-menu-item\" role=\"menuitem\"><a class=\"ui-corner-all\" tabindex=\"-1\">" + label + "</a></li>";
140
+ }
141
+ ul[0].innerHTML = lis.join("");
142
+ this._resizeMenu();
143
+
144
+ var items = $("li", ul).on("mouseover", "mouseout", function(event) {
145
+ if (event.type == "mouseover") {
146
+ self.menu.focus(event, $(this));
147
+ } else {
148
+ self.menu.blur();
149
+ }
150
+ });
151
+ for (var i = 0; i < items.length; i++) {
152
+ $(items[i]).data("ui-autocomplete-item", source[i]);
153
+ }
154
+ input.isFullMenu = true;
155
+ this._swapMenu()
156
+ // full menu has been rendered, now we can enable the show all button.
157
+ self.button.button("enable");
158
+ setTimeout(function() {
159
+ $(document).dequeue();
160
+ }, 0);
161
+ },
162
+
163
+ /* overwrite. make the matching string bold and added label decorator */
164
+ _renderItem: function(ul, item) {
165
+ var label = item.label.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(this.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
166
+ if (this.options.decoratorField != null) {
167
+ var d = item[this.options.decoratorField] || (item.option && $(item.option).attr(this.options.decoratorField));
168
+ if (d != undefined) {
169
+ label = label + " " + d;
170
+ }
171
+ }
172
+ return $("<li></li>")
173
+ .data("ui-autocomplete-item", item)
174
+ .append("<a>" + label + "</a>")
175
+ .appendTo(ul);
176
+ },
177
+
178
+ close: function() {
179
+ if (this.element.isFullMenu) {
180
+ this._swapMenu();
181
+ }
182
+ // super()
183
+ $.ui.autocomplete.prototype.close.call(this);
184
+ },
185
+
186
+ /* overwrite. to cleanup additional stuff that was added */
187
+ destroy: function() {
188
+ if (this.element.is("SELECT")) {
189
+ this.input.removeData("ui-combobox", "menuAll");
190
+ this.input.remove();
191
+ this.element.removeData().show();
192
+ return;
193
+ }
194
+ // super()
195
+ $.ui.autocomplete.prototype.destroy.call(this);
196
+ // clean up new stuff
197
+ this.element.removeClass("ui-widget ui-widget-content ui-corner-left");
198
+ this.button.remove();
199
+ },
200
+
201
+ /* overwrite. to swap out and preserve the full menu */
202
+ search: function(value, event) {
203
+ var input = this.element;
204
+ if (input.isFullMenu) {
205
+ this._swapMenu();
206
+ }
207
+ // super()
208
+ $.ui.autocomplete.prototype.search.call(this, value, event);
209
+ },
210
+
211
+ _change: function(event) {
212
+ if (!this.selectedItem) {
213
+ var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(this.element.val()) + "$", "i"),
214
+ match = $.grep(this.options.source, function(value) {
215
+ return matcher.test(value.label);
216
+ });
217
+ if (match.length) {
218
+ if (match[0].option != undefined) match[0].option.selected = true;
219
+ } else {
220
+ // remove invalid value, as it didn't match anything
221
+ if (this.options.selectElement) {
222
+ var firstItem = this.options.selectElement.children("option:first");
223
+ this.element.val(firstItem.text());
224
+ firstItem.prop("selected", true);
225
+ } else {
226
+ this.element.val("");
227
+ }
228
+ $(event.target).data("ui-combobox").previous = null; // this will force a change event
229
+ }
230
+ }
231
+ // super()
232
+ $.ui.autocomplete.prototype._change.call(this, event);
233
+ },
234
+
235
+ _swapMenu: function() {
236
+ var input = this.element,
237
+ data = input.data("ui-combobox"),
238
+ tmp = data.menuAll;
239
+ data.menuAll = data.menu.element.hide()[0];
240
+ data.menu.element[0] = tmp;
241
+ input.isFullMenu = !input.isFullMenu;
242
+ },
243
+
244
+ /* build the source array from the options of the select element */
245
+ _selectInit: function() {
246
+ var select = this.element,
247
+ selectClass = select.attr("class"),
248
+ selectStyle = select.attr("style"),
249
+ selected = select.children(":selected"),
250
+ value = $.trim(selected.text());
251
+ select.hide();
252
+ this.options.source = select.children("option").map(function() {
253
+ return {
254
+ label: $.trim(this.text),
255
+ option: this
256
+ };
257
+ }).toArray();
258
+ var userSelectCallback = this.options.select;
259
+ var userSelectedCallback = this.options.selected;
260
+ this.options.select = function(event, ui) {
261
+ ui.item.option.selected = true;
262
+ select.change();
263
+ if (userSelectCallback) userSelectCallback(event, ui);
264
+ // compatibility with jQuery UI's combobox.
265
+ if (userSelectedCallback) userSelectedCallback(event, ui);
266
+ };
267
+ this.options.selectElement = select;
268
+ this.input = $("<input>").insertAfter(select).val(value);
269
+ if (selectStyle) {
270
+ this.input.attr("style", selectStyle);
271
+ }
272
+ if (selectClass) {
273
+ this.input.attr("class", selectClass);
274
+ }
275
+ this.input.combobox(this.options);
276
+ },
277
+ inputbox: function() {
278
+ if (this.element.is("SELECT")) {
279
+ return this.input;
280
+ } else {
281
+ return this.element;
282
+ }
283
+ },
284
+
285
+ // custom part - setting combobox value
286
+ setValue: function (value) {
287
+ var input = $(this.element[0]).siblings('input.ui-autocomplete-input').first(),
288
+ selectEl = document.getElementById(this.element.attr('id')),
289
+ options = selectEl.options,
290
+ length = options.length;
291
+ for (var a = 0; a < length; a += 1) {
292
+ if (options[a].text === value) {
293
+ selectEl.selectedIndex = a;
294
+ input.val(options[a].text);
295
+ return false;
296
+ }
297
+ };
298
+ }
299
+ // end of custom part
300
+ });
301
+ })(jQuery);