├── .gitignore
├── LICENSE
├── README.md
├── app
├── build.gradle
├── libs
│ ├── ATTSpeechKit.jar
│ ├── AlchemyAPI_Java-0.9
│ │ ├── ChangeLog
│ │ ├── README
│ │ ├── build.xml
│ │ ├── build_no_tests.xml
│ │ ├── build_with_tests.xml
│ │ ├── src
│ │ │ └── com
│ │ │ │ └── alchemyapi
│ │ │ │ ├── api
│ │ │ │ ├── AlchemyAPI.java
│ │ │ │ ├── AlchemyAPI_CategoryParams.java
│ │ │ │ ├── AlchemyAPI_CombinedParams.java
│ │ │ │ ├── AlchemyAPI_ConceptParams.java
│ │ │ │ ├── AlchemyAPI_ConstraintQueryParams.java
│ │ │ │ ├── AlchemyAPI_ImageParams.java
│ │ │ │ ├── AlchemyAPI_KeywordParams.java
│ │ │ │ ├── AlchemyAPI_LanguageParams.java
│ │ │ │ ├── AlchemyAPI_NamedEntityParams.java
│ │ │ │ ├── AlchemyAPI_Params.java
│ │ │ │ ├── AlchemyAPI_RelationParams.java
│ │ │ │ ├── AlchemyAPI_TargetedSentimentParams.java
│ │ │ │ ├── AlchemyAPI_TaxonomyParams.java
│ │ │ │ └── AlchemyAPI_TextParams.java
│ │ │ │ └── test
│ │ │ │ ├── AuthorTest.java
│ │ │ │ ├── CategoryTest.java
│ │ │ │ ├── CombinedTest.java
│ │ │ │ ├── ConceptTest.java
│ │ │ │ ├── ConstraintQueryTest.java
│ │ │ │ ├── EntityTest.java
│ │ │ │ ├── FeedLinksTest.java
│ │ │ │ ├── ImageTest.java
│ │ │ │ ├── KeywordTest.java
│ │ │ │ ├── LanguageTest.java
│ │ │ │ ├── MicroformatTest.java
│ │ │ │ ├── ParameterTest.java
│ │ │ │ ├── RelationsTest.java
│ │ │ │ ├── SentimentTest.java
│ │ │ │ ├── TaxonomyTest.java
│ │ │ │ └── TextExtractTest.java
│ │ └── testdir
│ │ │ ├── api_key.txt
│ │ │ └── data
│ │ │ ├── example.html
│ │ │ ├── example2.html
│ │ │ ├── example2_nolinks.html
│ │ │ ├── example3.html
│ │ │ └── microformats.html
│ ├── cardboard.jar
│ ├── easyadapter-1.2.0.jar
│ ├── gson-2.3.jar
│ └── retrofit-1.7.1.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── dwai
│ │ └── yhack
│ │ └── captor
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ └── fonts
│ │ ├── Roboto-Black.ttf
│ │ ├── Roboto-BlackItalic.ttf
│ │ ├── Roboto-Bold.ttf
│ │ ├── Roboto-BoldItalic.ttf
│ │ ├── Roboto-Italic.ttf
│ │ ├── Roboto-Light.ttf
│ │ ├── Roboto-LightItalic.ttf
│ │ ├── Roboto-Medium.ttf
│ │ ├── Roboto-MediumItalic.ttf
│ │ ├── Roboto-Regular.ttf
│ │ ├── Roboto-Thin.ttf
│ │ └── Roboto-ThinItalic.ttf
│ ├── java
│ └── dwai
│ │ └── yhack
│ │ └── captor
│ │ └── ui
│ │ ├── activity
│ │ ├── ArActivity.java
│ │ ├── DatePosted.java
│ │ ├── HistoryActivity.java
│ │ ├── HistoryViewHolder.java
│ │ ├── JSONParser.java
│ │ ├── MyActivity.java
│ │ ├── OneItem.java
│ │ ├── SpeechAuth.java
│ │ ├── SpeechConfig.java
│ │ └── User.java
│ │ ├── ar
│ │ ├── GLUtils.java
│ │ ├── Renderer.java
│ │ └── WorldLayoutData.java
│ │ └── widget
│ │ └── CardboardOverlayView.java
│ └── res
│ ├── anim
│ └── slide_up.xml
│ ├── drawable-hdpi
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ └── ic_launcher.png
│ ├── drawable-xhdpi
│ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ ├── asdfsadf.png
│ ├── camera_b.xml
│ ├── camera_icon.png
│ ├── camera_pressed.png
│ ├── cardboard_b.xml
│ ├── cardboard_icon.png
│ ├── cardboard_pressed.png
│ ├── cardboard_splash.png
│ ├── history_button.png
│ ├── ic_history_black_48dp.png
│ ├── ic_launcher.png
│ ├── ic_search_white_48dp.png
│ └── kitten.jpg
│ ├── layout
│ ├── activity_ar.xml
│ ├── activity_history.xml
│ ├── activity_my.xml
│ └── subtitle_item.xml
│ ├── menu
│ ├── history.xml
│ ├── my.xml
│ └── options_menu.xml
│ ├── raw
│ ├── grid_fragment.shader
│ └── light_vertex.shader
│ ├── values-v21
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | .DS_Store
5 |
6 | # built application files
7 | *.apk
8 | *.ap_
9 |
10 | # files for the dex VM
11 | *.dex
12 |
13 | # Java class files
14 | *.class
15 |
16 | # generated files
17 | bin/
18 | gen/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Eclipse/IntelliJ project files
24 | .classpath
25 | .project
26 | default.properties
27 | .idea
28 | *.iml
29 | gen-external-apklibs
30 | target
31 | build
32 |
33 | # Output folder
34 | out/**
35 |
36 | # Misc
37 | .DS_Store
38 | app/res/values/keys.xml
39 | *.diff
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Captor
2 |
3 | ## WARNING: This code was built at a hackathon, therefore it is the most convoluted and messy code you will ever see. I might fix in in the future but for right now, it is what it is.
4 |
5 | If you would like to contribute, check out the issues of this repo and try to fix one!
6 |
7 | ## What is this?
8 | Automatic subtitles for the deaf using Google Cardboard. You can check out a video demo of it [here](https://www.youtube.com/watch?v=7iE2NuSeD9c)
9 |
10 | Built at YHack 2014 by Stefan, Fisher, Sashank and Alex.
11 |
12 | We used CardAR for the augmented reality portion of this hack. It is awesome. To find out more about it, [go here][0].
13 |
14 | This is an augmented reality hack that allows deaf people the ability to see subtitles in real life as they are speaking with somebody. We used Google's speech recognition to continously recognize speech and produced subtitles with it.
15 |
16 |
17 | ...
18 | [0]: https://github.com/mauimauer/cardar
19 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 21
5 | buildToolsVersion "20.0.0"
6 |
7 | defaultConfig {
8 | applicationId "dwai.yhack.cardar"
9 | minSdkVersion 15
10 | targetSdkVersion 20
11 | versionCode 3
12 | versionName "0.0.3"
13 | }
14 | buildTypes {
15 | release {
16 | runProguard false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile 'com.jakewharton:butterknife:5.1.1'
25 | compile 'com.jakewharton.timber:timber:2.4.1'
26 | compile files('libs/ATTSpeechKit.jar')
27 | compile files('libs/easyadapter-1.2.0.jar')
28 | compile files('libs/gson-2.3.jar')
29 | }
30 |
--------------------------------------------------------------------------------
/app/libs/ATTSpeechKit.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ColdSauce/Captor/c63a3d317dae9cc38a3e6d4ea217dfea8a96b1c6/app/libs/ATTSpeechKit.jar
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/ChangeLog:
--------------------------------------------------------------------------------
1 | CHANGELOG
2 |
3 | 0.9 - Added support for combined call, ranked taxonomy & image extraction.
4 | 0.8 - Added support for author extraction & targeted sentiment.
5 | 0.7 - Added support for relations extraction.
6 | 0.6 - Added support for sentiment analysis.
7 | 0.5 - Added GetRankedConcepts calls and parameter object.
8 | 0.4.2 - Added Parameters, added RDF support
9 | 0.4.1 - Fixed compilation error in Entities example code.
10 | 0.4 - Added GetRankedKeywords calls, added TextGetCategory call.
11 | 0.3 - Added ConstraintQuery call, imports changes, exception reporting
12 | changes, general improvements.
13 | 0.2 - Added setApiKey() call, setApiHost() call, updated API endpoint.
14 | 0.1 - Initial Release
15 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/README:
--------------------------------------------------------------------------------
1 | ================================
2 | AlchemyAPI Java SDK: version 0.9
3 | ================================
4 |
5 | This is a Java implementation of the AlchemyAPI SDK.
6 |
7 |
8 | INSTALLATION
9 |
10 | AlchemyAPI Java SDK provides Ant build files for systems lacking JUnit,
11 | an addition to JUnit-enabled build files. To build AlchemyAPI Java SDK
12 | without JUnit tests, type the following Ant command:
13 |
14 | ant jar
15 |
16 | If you desire to build AlchemyAPI Java SDK with JUnit tests enabled,
17 | rename your Ant .xml files and build using the following commands:
18 |
19 | ln -sf build_with_tests.xml build.xml; ant jar
20 |
21 |
22 | RUNNING EXAMPLES
23 |
24 | Several code examples are included to illustrate using the AlchemyAPI
25 | for named entity extraction, text classification, language identification,
26 | and other tasks.
27 |
28 | All code samples should be run from within the "testdir" directory.
29 |
30 | To run these code samples you must first edit the (testdir/api_key.txt) file,
31 | adding your assigned AlchemyAPI key.
32 |
33 | Code Samples:
34 |
35 | 1. Entity Extraction: java -jar ../dist/AlchemyAPI-Entity-Test.jar
36 |
37 | 2. Concept Tagging: java -jar ../dist/AlchemyAPI-Concept-Test.jar
38 |
39 | 3. Keyword Extraction: java -jar ../dist/AlchemyAPI-Keyword-Test.jar
40 |
41 | 4. Text Categorization: java -jar ../dist/AlchemyAPI-Category-Test.jar
42 |
43 | 5. Language Identification: java -jar ../dist/AlchemyAPI-Language-Test.jar
44 |
45 | 6. HTML Text Extraction: java -jar ../dist/AlchemyAPI-TextExtract-Test.jar
46 |
47 | 7. HTML Structured Content Scraping: java -jar ../dist/AlchemyAPI-ConstraintQuery-Test.jar
48 |
49 | 8. Microformats Extraction: java -jar ../dist/AlchemyAPI-Microformats-Test.jar
50 |
51 | 9. RSS / ATOM Feed Links Extraction: java -jar ../dist/AlchemyAPI-FeedLinks-Test.jar
52 |
53 | 10. Sentiment Analysis: java -jar ../dist/AlchemyAPI-Sentiment-Test.jar
54 |
55 | 11. Relations: java -jar ../dist/AlchemyAPI-Relations-Test.jar
56 |
57 | 12. Example of using the parameters object: java -jar ../dist/AlchemyAPI-Parameter-Test.jar
58 |
59 | 13. Author Extraction: java -jar ../dist/AlchemyAPI-Author-Test.jar
60 |
61 | 14. Combined Data Extraction: java -jar ../dist/AlchemyAPI-Combined-Test.jar
62 |
63 | 15. Ranked Taxonomy Extraction: java -jar ../dist/AlchemyAPI-Taxonomy-Test.jar
64 |
65 | 16. Image Extraction: java -jar ../dist/AlchemyAPI-Image-Test.jar
66 |
67 |
68 | DEPENDENCIES
69 |
70 | This module requires these other modules and libraries:
71 |
72 | Java JDK 1.5.x
73 | ANT (to build the packages)
74 | JUnit (optional, to build the tests)
75 |
76 |
77 | COPYRIGHT AND LICENCE
78 |
79 | Copyright (C) Orchestr8, LLC.
80 |
81 | This library is free software; you can redistribute it and/or modify
82 | it under the same terms as Perl version 5.8.5 or, at your option,
83 | any later version of Perl 5 you may have available.
84 |
85 |
86 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Build file for AlchemyAPI code / examples.
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/build_no_tests.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Build file for AlchemyAPI code / examples.
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/build_with_tests.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Build file for AlchemyAPI code / examples.
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_CategoryParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 |
3 | import java.io.UnsupportedEncodingException;
4 | import java.net.URLEncoder;
5 |
6 | public class AlchemyAPI_CategoryParams extends AlchemyAPI_Params {
7 | public static final String CLEANED_OR_RAW = "cleaned_or_raw";
8 | public static final String CQUERY = "cquery";
9 | public static final String XPATH = "xpath";
10 |
11 | private String sourceText;
12 | private String cQuery;
13 | private String xPath;
14 | private String baseUrl;
15 |
16 | public String getSourceText() {
17 | return sourceText;
18 | }
19 | public void setSourceText(String sourceText) {
20 | if( !sourceText.equals(AlchemyAPI_CategoryParams.CLEANED_OR_RAW)
21 | && !sourceText.equals(AlchemyAPI_CategoryParams.CQUERY)
22 | && !sourceText.equals(AlchemyAPI_CategoryParams.XPATH))
23 | {
24 | throw new RuntimeException("Invalid setting " + sourceText + " for parameter sourceText");
25 | }
26 | this.sourceText = sourceText;
27 | }
28 | public String getCQuery() {
29 | return cQuery;
30 | }
31 | public void setCQuery(String cQuery) {
32 | this.cQuery = cQuery;
33 | }
34 | public String getXPath() {
35 | return xPath;
36 | }
37 | public void setXPath(String xPath) {
38 | this.xPath = xPath;
39 | }
40 | public String getBaseUrl() {
41 | return baseUrl;
42 | }
43 | public void setBaseUrl(String baseUrl) {
44 | this.baseUrl = baseUrl;
45 | }
46 |
47 | public String getParameterString(){
48 | String retString = super.getParameterString();
49 | try{
50 | if(sourceText!=null) retString+="&sourceText="+sourceText;
51 | if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
52 | if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
53 | if(baseUrl!=null) retString+="&baseUrl="+URLEncoder.encode(baseUrl,"UTF-8");
54 | }
55 | catch(UnsupportedEncodingException e ){
56 | retString = "";
57 | }
58 | return retString;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_CombinedParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 | import java.net.URLEncoder;
3 | import java.io.UnsupportedEncodingException;
4 |
5 |
6 |
7 | public class AlchemyAPI_CombinedParams extends AlchemyAPI_Params{
8 | public static final String CLEANED_OR_RAW = "cleaned_or_raw";
9 | public static final String CLEANED = "cleaned";
10 | public static final String RAW = "raw";
11 | public static final String CQUERY = "cquery";
12 | public static final String XPATH = "xpath";
13 | public static final String EXTRACT_MODE_TRUST = "trust-metadata";
14 | public static final String EXTRACT_MODE_INFER = "always-infer";
15 | public static final String EXTRACT_PAGE_IMAGE = "page-image";
16 | public static final String EXTRACT_ENTITY = "entity";
17 | public static final String EXTRACT_KEYWORD = "keyword";
18 | public static final String EXTRACT_TITLE = "title";
19 | public static final String EXTRACT_AUTHOR = "author";
20 | public static final String EXTRACT_TAXONOMY = "taxonomy";
21 | public static final String EXTRACT_CONCEPT = "concept";
22 | public static final String EXTRACT_RELATION = "relation";
23 | public static final String EXTRACT_DOC_SENTIMENT = "doc-sentiment";
24 |
25 | private Boolean disambiguate;
26 | private Boolean linkedData;
27 | private Boolean coreference;
28 | private Boolean quotations;
29 | private String sourceText;
30 | private Boolean showSourceText;
31 | private String cQuery;
32 | private String xPath;
33 | private Integer maxRetrieve;
34 | private String baseUrl;
35 | private Boolean sentiment = false;
36 | private String extractMode;
37 | private String extract;
38 |
39 | public boolean isDisambiguate() {
40 | return disambiguate;
41 | }
42 | public void setDisambiguate(boolean disambiguate) {
43 | this.disambiguate = disambiguate;
44 | }
45 | public boolean isLinkedData() {
46 | return linkedData;
47 | }
48 | public void setLinkedData(boolean linkedData) {
49 | this.linkedData = linkedData;
50 | }
51 | public boolean isCoreference() {
52 | return coreference;
53 | }
54 | public void setCoreference(boolean coreference) {
55 | this.coreference = coreference;
56 | }
57 | public boolean isQuotations() {
58 | return quotations;
59 | }
60 | public void setQuotations(boolean quotations) {
61 | this.quotations = quotations;
62 | }
63 | public String getSourceText() {
64 | return sourceText;
65 | }
66 | public void setSourceText(String sourceText) {
67 | if( !sourceText.equals(AlchemyAPI_CombinedParams.CLEANED) && !sourceText.equals(AlchemyAPI_CombinedParams.CLEANED_OR_RAW)
68 | && !sourceText.equals(AlchemyAPI_CombinedParams.RAW) && !sourceText.equals(AlchemyAPI_CombinedParams.CQUERY)
69 | && !sourceText.equals(AlchemyAPI_CombinedParams.XPATH))
70 | {
71 | throw new RuntimeException("Invalid setting " + sourceText + " for parameter sourceText");
72 | }
73 | this.sourceText = sourceText;
74 | }
75 | public boolean isShowSourceText() {
76 | return showSourceText;
77 | }
78 | public void setShowSourceText(boolean showSourceText) {
79 | this.showSourceText = showSourceText;
80 | }
81 | public String getCQuery() {
82 | return cQuery;
83 | }
84 | public void setCQuery(String cQuery) {
85 | this.cQuery = cQuery;
86 | }
87 | public String getXPath() {
88 | return xPath;
89 | }
90 | public void setXPath(String xPath) {
91 | this.xPath = xPath;
92 | }
93 | public int getMaxRetrieve() {
94 | return maxRetrieve;
95 | }
96 | public void setMaxRetrieve(int maxRetrieve) {
97 | this.maxRetrieve = maxRetrieve;
98 | }
99 | public String getBaseUrl() {
100 | return baseUrl;
101 | }
102 | public void setBaseUrl(String baseUrl) {
103 | this.baseUrl = baseUrl;
104 | }
105 | public boolean isSentiment() {
106 | return sentiment;
107 | }
108 | public void setSentiment(boolean sentiment) {
109 | this.sentiment = sentiment;
110 | }
111 | public void setExtractMode(String extractMode) {
112 | if( !extractMode.equals(EXTRACT_MODE_TRUST) && !extractMode.equals(EXTRACT_MODE_INFER) )
113 | {
114 | throw new RuntimeException("Invalid setting " + extractMode + " for parameter extractMode");
115 | }
116 | this.extractMode = extractMode;
117 | }
118 | public void setExtractAll() {
119 | this.extract = EXTRACT_PAGE_IMAGE + EXTRACT_ENTITY + EXTRACT_KEYWORD
120 | + EXTRACT_TITLE + EXTRACT_AUTHOR + EXTRACT_TAXONOMY
121 | + EXTRACT_CONCEPT + EXTRACT_RELATION + EXTRACT_DOC_SENTIMENT;
122 | }
123 | public void setExtract(String extractArg) {
124 | if( !extractArg.equals(EXTRACT_PAGE_IMAGE)
125 | && !extractArg.equals(EXTRACT_ENTITY)
126 | && !extractArg.equals(EXTRACT_KEYWORD)
127 | && !extractArg.equals(EXTRACT_TITLE)
128 | && !extractArg.equals(EXTRACT_AUTHOR)
129 | && !extractArg.equals(EXTRACT_TAXONOMY)
130 | && !extractArg.equals(EXTRACT_CONCEPT)
131 | && !extractArg.equals(EXTRACT_RELATION)
132 | && !extractArg.equals(EXTRACT_DOC_SENTIMENT) )
133 | {
134 | throw new RuntimeException("Invalid setting " + extractArg + " for parameter extract");
135 | }
136 | if ((null == this.extract) || (0 == this.extract.length()))
137 | this.extract = extractArg;
138 | else
139 | this.extract += "," + extractArg;
140 | }
141 | public String getParameterString(){
142 | String retString = super.getParameterString();
143 | try{
144 | if (extractMode!=null) retString+="&extractMode="+extractMode;
145 | if (extract!=null) retString+="&extract="+extract;
146 | if(sentiment!=null) retString+="&sentiment="+(sentiment?"1":"0");
147 | if(showSourceText!=null) retString+="&showSourceText="+(showSourceText?"1":"0");
148 | if(maxRetrieve!=null) retString+="&maxRetrieve="+maxRetrieve.toString();
149 | if(baseUrl!=null) retString+="&baseUrl="+URLEncoder.encode(baseUrl,"UTF-8");
150 | if(disambiguate!=null) retString+="&disambiguate="+(disambiguate ? "1":"0");
151 | if(linkedData!=null) retString+="&linkedData="+(linkedData?"1":"0");
152 | if(coreference!=null) retString+="&coreference="+(coreference?"1":"0");
153 | if(quotations!=null) retString+=""ations="+(quotations?"1":"0");
154 | if(sourceText!=null) retString+="&sourceText="+sourceText;
155 | if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
156 | if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
157 | }
158 | catch(UnsupportedEncodingException e ){
159 | retString = "";
160 | }
161 | return retString;
162 | }
163 | }
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_ConceptParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 | import java.net.URLEncoder;
3 | import java.io.UnsupportedEncodingException;
4 |
5 |
6 |
7 | public class AlchemyAPI_ConceptParams extends AlchemyAPI_Params{
8 | public static final String CLEANED_OR_RAW = "cleaned_or_raw";
9 | public static final String CLEANED = "cleaned";
10 | public static final String RAW = "raw";
11 | public static final String CQUERY = "cquery";
12 | public static final String XPATH = "xpath";
13 |
14 | private Integer maxRetrieve;
15 | private String sourceText;
16 | private Boolean showSourceText;
17 | private String cQuery;
18 | private String xPath;
19 | private Boolean linkedData;
20 |
21 | public String getSourceText() {
22 | return sourceText;
23 | }
24 |
25 | public void setSourceText(String sourceText) {
26 | if( !sourceText.equals(AlchemyAPI_ConceptParams.CLEANED) && !sourceText.equals(AlchemyAPI_ConceptParams.CLEANED_OR_RAW)
27 | && !sourceText.equals(AlchemyAPI_ConceptParams.RAW) && !sourceText.equals(AlchemyAPI_ConceptParams.CQUERY)
28 | && !sourceText.equals(AlchemyAPI_ConceptParams.XPATH))
29 | {
30 | throw new RuntimeException("Invalid setting " + sourceText + " for parameter sourceText");
31 | }
32 | this.sourceText = sourceText;
33 | }
34 |
35 | public boolean isShowSourceText() {
36 | return showSourceText;
37 | }
38 |
39 | public void setShowSourceText(boolean showSourceText) {
40 | this.showSourceText = showSourceText;
41 | }
42 |
43 | public String getCQuery() {
44 | return cQuery;
45 | }
46 |
47 | public void setCQuery(String cQuery) {
48 | this.cQuery = cQuery;
49 | }
50 |
51 | public String getXPath() {
52 | return xPath;
53 | }
54 |
55 | public void setXPath(String xPath) {
56 | this.xPath = xPath;
57 | }
58 |
59 | public int getMaxRetrieve() {
60 | return maxRetrieve;
61 | }
62 |
63 | public void setMaxRetrieve(int maxRetrieve) {
64 | this.maxRetrieve = maxRetrieve;
65 | }
66 |
67 | public boolean isLinkedData() {
68 | return linkedData;
69 | }
70 |
71 | public void setLinkedData(boolean linkedData) {
72 | this.linkedData = linkedData;
73 | }
74 |
75 | public String getParameterString(){
76 | String retString = super.getParameterString();
77 | try{
78 | if(sourceText!=null) retString+="&sourceText="+sourceText;
79 | if(showSourceText!=null) retString+="&showSourceText="+(showSourceText?"1":"0");
80 | if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
81 | if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
82 | if(maxRetrieve!=null) retString+="&maxRetrieve="+maxRetrieve.toString();
83 | if(linkedData!=null) retString+="&linkedData="+(linkedData?"1":"0");
84 | }
85 | catch(UnsupportedEncodingException e ){
86 | retString = "";
87 | }
88 | return retString;
89 | }
90 |
91 |
92 |
93 | }
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_ConstraintQueryParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 | import java.net.URLEncoder;
3 | import java.io.UnsupportedEncodingException;
4 |
5 |
6 |
7 | public class AlchemyAPI_ConstraintQueryParams extends AlchemyAPI_Params{
8 |
9 | private String cQuery;
10 |
11 | public String getCQuery() {
12 | return cQuery;
13 | }
14 | public void setCQuery(String cQuery) {
15 | this.cQuery = cQuery;
16 | }
17 |
18 |
19 | public String getParameterString(){
20 | String retString = super.getParameterString();
21 | try{
22 | if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
23 | }
24 | catch(UnsupportedEncodingException e ){
25 | retString = "";
26 | }
27 | return retString;
28 | }
29 |
30 |
31 |
32 | }
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_ImageParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 | import java.net.URLEncoder;
3 | import java.io.UnsupportedEncodingException;
4 |
5 |
6 |
7 | public class AlchemyAPI_ImageParams extends AlchemyAPI_Params{
8 | public static final String CQUERY = "cquery";
9 | public static final String XPATH = "xpath";
10 |
11 | private String cQuery;
12 | private String xPath;
13 | private Integer maxRetrieve;
14 | private String baseUrl;
15 |
16 | public String getCQuery() {
17 | return cQuery;
18 | }
19 | public void setCQuery(String cQuery) {
20 | this.cQuery = cQuery;
21 | }
22 | public String getXPath() {
23 | return xPath;
24 | }
25 | public void setXPath(String xPath) {
26 | this.xPath = xPath;
27 | }
28 | public int getMaxRetrieve() {
29 | return maxRetrieve;
30 | }
31 | public void setMaxRetrieve(int maxRetrieve) {
32 | this.maxRetrieve = maxRetrieve;
33 | }
34 | public String getBaseUrl() {
35 | return baseUrl;
36 | }
37 | public void setBaseUrl(String baseUrl) {
38 | this.baseUrl = baseUrl;
39 | }
40 |
41 | public String getParameterString(){
42 | String retString = super.getParameterString();
43 | try{
44 | if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
45 | if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
46 | if(maxRetrieve!=null) retString+="&maxRetrieve="+maxRetrieve.toString();
47 | if(baseUrl!=null) retString+="&baseUrl="+URLEncoder.encode(baseUrl,"UTF-8");
48 | }
49 | catch(UnsupportedEncodingException e ){
50 | retString = "";
51 | }
52 | return retString;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_KeywordParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 | import java.net.URLEncoder;
3 | import java.io.UnsupportedEncodingException;
4 |
5 |
6 |
7 | public class AlchemyAPI_KeywordParams extends AlchemyAPI_Params{
8 | public static final String CLEANED_OR_RAW = "cleaned_or_raw";
9 | public static final String CLEANED = "cleaned";
10 | public static final String RAW = "raw";
11 | public static final String CQUERY = "cquery";
12 | public static final String XPATH = "xpath";
13 |
14 | public static final String EXTRACT_MODE_STRICT = "strict";
15 |
16 | private Integer maxRetrieve;
17 | private String sourceText;
18 | private Boolean showSourceText;
19 | private Boolean sentiment;
20 | private String cQuery;
21 | private String xPath;
22 | private String baseUrl;
23 | private String keywordExtractMode;
24 |
25 | public String getKeywordExtractMode() {
26 | return keywordExtractMode;
27 | }
28 |
29 | public void setKeywordExtractMode(String keywordExtractMode) {
30 | if( !keywordExtractMode.equals(AlchemyAPI_KeywordParams.EXTRACT_MODE_STRICT))
31 | {
32 | throw new RuntimeException("Invalid setting " + keywordExtractMode + " for parameter keywordExtractMode");
33 | }
34 | this.keywordExtractMode = keywordExtractMode;
35 | }
36 |
37 | public String getSourceText() {
38 | return sourceText;
39 | }
40 |
41 | public void setSourceText(String sourceText) {
42 | if( !sourceText.equals(AlchemyAPI_KeywordParams.CLEANED) && !sourceText.equals(AlchemyAPI_KeywordParams.CLEANED_OR_RAW)
43 | && !sourceText.equals(AlchemyAPI_KeywordParams.RAW) && !sourceText.equals(AlchemyAPI_KeywordParams.CQUERY)
44 | && !sourceText.equals(AlchemyAPI_KeywordParams.XPATH))
45 | {
46 | throw new RuntimeException("Invalid setting " + sourceText + " for parameter sourceText");
47 | }
48 | this.sourceText = sourceText;
49 | }
50 |
51 | public boolean isShowSourceText() {
52 | return showSourceText;
53 | }
54 |
55 | public void setShowSourceText(boolean showSourceText) {
56 | this.showSourceText = showSourceText;
57 | }
58 |
59 | public boolean isSentiment() {
60 | return sentiment;
61 | }
62 |
63 | public void setSentiment(boolean sentiment) {
64 | this.sentiment = sentiment;
65 | }
66 |
67 | public String getCQuery() {
68 | return cQuery;
69 | }
70 |
71 | public void setCQuery(String cQuery) {
72 | this.cQuery = cQuery;
73 | }
74 |
75 | public String getXPath() {
76 | return xPath;
77 | }
78 |
79 | public void setXPath(String xPath) {
80 | this.xPath = xPath;
81 | }
82 |
83 | public int getMaxRetrieve() {
84 | return maxRetrieve;
85 | }
86 |
87 | public void setMaxRetrieve(int maxRetrieve) {
88 | this.maxRetrieve = maxRetrieve;
89 | }
90 |
91 | public String getBaseUrl() {
92 | return baseUrl;
93 | }
94 |
95 | public void setBaseUrl(String baseUrl) {
96 | this.baseUrl = baseUrl;
97 | }
98 |
99 | public String getParameterString(){
100 | String retString = super.getParameterString();
101 | try{
102 | if(sourceText!=null) retString+="&sourceText="+sourceText;
103 | if(showSourceText!=null) retString+="&showSourceText="+(showSourceText?"1":"0");
104 | if(sentiment!=null) retString+="&sentiment="+(sentiment?"1":"0");
105 | if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
106 | if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
107 | if(maxRetrieve!=null) retString+="&maxRetrieve="+maxRetrieve.toString();
108 | if(baseUrl!=null) retString+="&baseUrl="+URLEncoder.encode(baseUrl,"UTF-8");
109 | if(keywordExtractMode!=null) retString+="&keywordExtractMode="+URLEncoder.encode(keywordExtractMode,"UTF-8");
110 | }
111 | catch(UnsupportedEncodingException e ){
112 | retString = "";
113 | }
114 | return retString;
115 | }
116 |
117 |
118 |
119 | }
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_LanguageParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 |
3 | import java.io.UnsupportedEncodingException;
4 | import java.net.URLEncoder;
5 |
6 | public class AlchemyAPI_LanguageParams extends AlchemyAPI_Params {
7 | public static final String CLEANED_OR_RAW = "cleaned_or_raw";
8 | public static final String CLEANED = "cleaned";
9 | public static final String RAW = "raw";
10 | public static final String CQUERY = "cquery";
11 | public static final String XPATH = "xpath";
12 |
13 | private String sourceText;
14 | private String cQuery;
15 | private String xPath;
16 |
17 | public String getSourceText() {
18 | return sourceText;
19 | }
20 |
21 | public void setSourceText(String sourceText) {
22 | if( !sourceText.equals(AlchemyAPI_LanguageParams.CLEANED_OR_RAW)
23 | && !sourceText.equals(AlchemyAPI_LanguageParams.CQUERY)
24 | && !sourceText.equals(AlchemyAPI_LanguageParams.XPATH))
25 | {
26 | throw new RuntimeException("Invalid setting " + sourceText + " for parameter sourceText");
27 | }
28 | this.sourceText = sourceText;
29 | }
30 |
31 | public String getCQuery() {
32 | return cQuery;
33 | }
34 |
35 | public void setCQuery(String cQuery) {
36 | this.cQuery = cQuery;
37 | }
38 |
39 | public String getXPath() {
40 | return xPath;
41 | }
42 |
43 | public void setXPath(String xPath) {
44 | this.xPath = xPath;
45 | }
46 |
47 | public String getParameterString(){
48 | String retString = super.getParameterString();
49 | try{
50 | if(sourceText!=null) retString+="&sourceText="+sourceText;
51 | if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
52 | if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
53 | }
54 | catch(UnsupportedEncodingException e ){
55 | retString = "";
56 | }
57 | return retString;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_NamedEntityParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 | import java.net.URLEncoder;
3 | import java.io.UnsupportedEncodingException;
4 |
5 |
6 |
7 | public class AlchemyAPI_NamedEntityParams extends AlchemyAPI_Params{
8 | public static final String CLEANED_OR_RAW = "cleaned_or_raw";
9 | public static final String CLEANED = "cleaned";
10 | public static final String RAW = "raw";
11 | public static final String CQUERY = "cquery";
12 | public static final String XPATH = "xpath";
13 |
14 | private Boolean disambiguate;
15 | private Boolean linkedData;
16 | private Boolean coreference;
17 | private Boolean quotations;
18 | private String sourceText;
19 | private Boolean showSourceText;
20 | private String cQuery;
21 | private String xPath;
22 | private Integer maxRetrieve;
23 | private String baseUrl;
24 | private Boolean sentiment;
25 |
26 | public boolean isDisambiguate() {
27 | return disambiguate;
28 | }
29 | public void setDisambiguate(boolean disambiguate) {
30 | this.disambiguate = disambiguate;
31 | }
32 | public boolean isLinkedData() {
33 | return linkedData;
34 | }
35 | public void setLinkedData(boolean linkedData) {
36 | this.linkedData = linkedData;
37 | }
38 | public boolean isCoreference() {
39 | return coreference;
40 | }
41 | public void setCoreference(boolean coreference) {
42 | this.coreference = coreference;
43 | }
44 | public boolean isQuotations() {
45 | return quotations;
46 | }
47 | public void setQuotations(boolean quotations) {
48 | this.quotations = quotations;
49 | }
50 | public String getSourceText() {
51 | return sourceText;
52 | }
53 | public void setSourceText(String sourceText) {
54 | if( !sourceText.equals(AlchemyAPI_NamedEntityParams.CLEANED) && !sourceText.equals(AlchemyAPI_NamedEntityParams.CLEANED_OR_RAW)
55 | && !sourceText.equals(AlchemyAPI_NamedEntityParams.RAW) && !sourceText.equals(AlchemyAPI_NamedEntityParams.CQUERY)
56 | && !sourceText.equals(AlchemyAPI_NamedEntityParams.XPATH))
57 | {
58 | throw new RuntimeException("Invalid setting " + sourceText + " for parameter sourceText");
59 | }
60 | this.sourceText = sourceText;
61 | }
62 | public boolean isShowSourceText() {
63 | return showSourceText;
64 | }
65 | public void setShowSourceText(boolean showSourceText) {
66 | this.showSourceText = showSourceText;
67 | }
68 | public String getCQuery() {
69 | return cQuery;
70 | }
71 | public void setCQuery(String cQuery) {
72 | this.cQuery = cQuery;
73 | }
74 | public String getXPath() {
75 | return xPath;
76 | }
77 | public void setXPath(String xPath) {
78 | this.xPath = xPath;
79 | }
80 | public int getMaxRetrieve() {
81 | return maxRetrieve;
82 | }
83 | public void setMaxRetrieve(int maxRetrieve) {
84 | this.maxRetrieve = maxRetrieve;
85 | }
86 | public String getBaseUrl() {
87 | return baseUrl;
88 | }
89 | public void setBaseUrl(String baseUrl) {
90 | this.baseUrl = baseUrl;
91 | }
92 | public boolean isSentiment() {
93 | return sentiment;
94 | }
95 | public void setSentiment(boolean sentiment) {
96 | this.sentiment = sentiment;
97 | }
98 |
99 | public String getParameterString(){
100 | String retString = super.getParameterString();
101 | try{
102 | if(disambiguate!=null) retString+="&disambiguate="+(disambiguate ? "1":"0");
103 | if(linkedData!=null) retString+="&linkedData="+(linkedData?"1":"0");
104 | if(coreference!=null) retString+="&coreference="+(coreference?"1":"0");
105 | if(quotations!=null) retString+=""ations="+(quotations?"1":"0");
106 | if(sourceText!=null) retString+="&sourceText="+sourceText;
107 | if(showSourceText!=null) retString+="&showSourceText="+(showSourceText?"1":"0");
108 | if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
109 | if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
110 | if(maxRetrieve!=null) retString+="&maxRetrieve="+maxRetrieve.toString();
111 | if(baseUrl!=null) retString+="&baseUrl="+URLEncoder.encode(baseUrl,"UTF-8");
112 | if(sentiment!=null) retString+="&sentiment="+(sentiment?"1":"0");
113 | }
114 | catch(UnsupportedEncodingException e ){
115 | retString = "";
116 | }
117 | return retString;
118 | }
119 |
120 |
121 |
122 | }
123 |
124 |
125 |
126 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_Params.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 |
3 | import java.io.UnsupportedEncodingException;
4 | import java.net.URLEncoder;
5 |
6 |
7 |
8 | public class AlchemyAPI_Params {
9 | public static final String OUTPUT_XML = "xml";
10 | public static final String OUTPUT_RDF = "rdf";
11 |
12 | private String url;
13 | private String html;
14 | private String text;
15 | private String outputMode = OUTPUT_XML;
16 | private String customParameters;
17 |
18 | public String getUrl() {
19 | return url;
20 | }
21 | public void setUrl(String url) {
22 | this.url = url;
23 | }
24 | public String getHtml() {
25 | return html;
26 | }
27 | public void setHtml(String html) {
28 | this.html = html;
29 | }
30 | public String getText() {
31 | return text;
32 | }
33 | public void setText(String text) {
34 | this.text = text;
35 | }
36 | public String getOutputMode() {
37 | return outputMode;
38 | }
39 | public void setOutputMode(String outputMode) {
40 | if( !outputMode.equals(AlchemyAPI_Params.OUTPUT_XML) && !outputMode.equals(OUTPUT_RDF) )
41 | {
42 | throw new RuntimeException("Invalid setting " + outputMode + " for parameter outputMode");
43 | }
44 | this.outputMode = outputMode;
45 | }
46 | public String getCustomParameters() {
47 | return customParameters;
48 | }
49 |
50 | public void setCustomParameters(String... customParameters) {
51 | StringBuilder data = new StringBuilder();
52 | try{
53 | for (int i = 0; i < customParameters.length; ++i) {
54 | data.append('&').append(customParameters[i]);
55 | if (++i < customParameters.length)
56 | data.append('=').append(URLEncoder.encode(customParameters[i], "UTF8"));
57 | }
58 | }
59 | catch(UnsupportedEncodingException e){
60 | this.customParameters = "";
61 | return;
62 | }
63 | this.customParameters = data.toString();
64 | }
65 |
66 | public String getParameterString(){
67 | String retString = "";
68 | try{
69 | if(url!=null) retString+="&url="+URLEncoder.encode(url,"UTF-8");
70 | if(html!=null) retString+="&html="+URLEncoder.encode(html,"UTF-8");
71 | if(text!=null) retString+="&text="+URLEncoder.encode(text,"UTF-8");
72 | if(customParameters!=null) retString+=customParameters;
73 | if(outputMode!=null) retString+="&outputMode="+outputMode;
74 | }
75 | catch(UnsupportedEncodingException e ){
76 | retString = "";
77 | }
78 | return retString;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_RelationParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 | import java.net.URLEncoder;
3 | import java.io.UnsupportedEncodingException;
4 |
5 |
6 |
7 | public class AlchemyAPI_RelationParams extends AlchemyAPI_Params{
8 | public static final String CLEANED_OR_RAW = "cleaned_or_raw";
9 | public static final String CLEANED = "cleaned";
10 | public static final String RAW = "raw";
11 | public static final String CQUERY = "cquery";
12 | public static final String XPATH = "xpath";
13 |
14 | private Boolean disambiguate;
15 | private Boolean linkedData;
16 | private Boolean coreference;
17 | private String sourceText;
18 | private Boolean showSourceText;
19 | private Boolean entities;
20 | private Boolean sentimentExcludeEntities;
21 | private Boolean requireEntities;
22 | private String cQuery;
23 | private String xPath;
24 | private Integer maxRetrieve;
25 | private String baseUrl;
26 | private Boolean sentiment;
27 |
28 | public boolean isDisambiguate() {
29 | return disambiguate;
30 | }
31 | public void setDisambiguate(boolean disambiguate) {
32 | this.disambiguate = disambiguate;
33 | }
34 | public boolean isLinkedData() {
35 | return linkedData;
36 | }
37 | public void setLinkedData(boolean linkedData) {
38 | this.linkedData = linkedData;
39 | }
40 | public boolean isCoreference() {
41 | return coreference;
42 | }
43 | public void setCoreference(boolean coreference) {
44 | this.coreference = coreference;
45 | }
46 |
47 | public String getSourceText() {
48 | return sourceText;
49 | }
50 | public void setSourceText(String sourceText) {
51 | if( !sourceText.equals(AlchemyAPI_NamedEntityParams.CLEANED) && !sourceText.equals(AlchemyAPI_NamedEntityParams.CLEANED_OR_RAW)
52 | && !sourceText.equals(AlchemyAPI_NamedEntityParams.RAW) && !sourceText.equals(AlchemyAPI_NamedEntityParams.CQUERY)
53 | && !sourceText.equals(AlchemyAPI_NamedEntityParams.XPATH))
54 | {
55 | throw new RuntimeException("Invalid setting " + sourceText + " for parameter sourceText");
56 | }
57 | this.sourceText = sourceText;
58 | }
59 | public boolean isShowSourceText() {
60 | return showSourceText;
61 | }
62 | public void setShowSourceText(boolean showSourceText) {
63 | this.showSourceText = showSourceText;
64 | }
65 | public boolean isEntities() {
66 | return entities;
67 | }
68 | public void setEntities(boolean entities) {
69 | this.entities = entities;
70 | }
71 | public boolean isSentimentExcludeEntities() {
72 | return sentimentExcludeEntities;
73 | }
74 | public void setSentimentExcludeEntities(boolean sentimentExcludeEntities) {
75 | this.sentimentExcludeEntities = sentimentExcludeEntities;
76 | }
77 | public boolean isRequireEntities() {
78 | return requireEntities;
79 | }
80 | public void setRequireEntities(boolean requireEntities) {
81 | this.requireEntities = requireEntities;
82 | }
83 | public String getCQuery() {
84 | return cQuery;
85 | }
86 | public void setCQuery(String cQuery) {
87 | this.cQuery = cQuery;
88 | }
89 | public String getXPath() {
90 | return xPath;
91 | }
92 | public void setXPath(String xPath) {
93 | this.xPath = xPath;
94 | }
95 | public int getMaxRetrieve() {
96 | return maxRetrieve;
97 | }
98 | public void setMaxRetrieve(int maxRetrieve) {
99 | this.maxRetrieve = maxRetrieve;
100 | }
101 | public String getBaseUrl() {
102 | return baseUrl;
103 | }
104 | public void setBaseUrl(String baseUrl) {
105 | this.baseUrl = baseUrl;
106 | }
107 | public boolean isSentiment() {
108 | return sentiment;
109 | }
110 | public void setSentiment(boolean sentiment) {
111 | this.sentiment = sentiment;
112 | }
113 |
114 | public String getParameterString(){
115 | String retString = super.getParameterString();
116 | try{
117 | if(disambiguate!=null) retString+="&disambiguate="+(disambiguate ? "1":"0");
118 | if(linkedData!=null) retString+="&linkedData="+(linkedData?"1":"0");
119 | if(coreference!=null) retString+="&coreference="+(coreference?"1":"0");
120 | if(sourceText!=null) retString+="&sourceText="+sourceText;
121 | if(showSourceText!=null) retString+="&showSourceText="+(showSourceText?"1":"0");
122 | if(entities!=null) retString+="&entities="+(entities?"1":"0");
123 | if(sentimentExcludeEntities!=null) retString+="&sentimentExcludeEntities="+(sentimentExcludeEntities?"1":"0");
124 | if(requireEntities!=null) retString+="&requireEntities="+(requireEntities?"1":"0");
125 | if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
126 | if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
127 | if(maxRetrieve!=null) retString+="&maxRetrieve="+maxRetrieve.toString();
128 | if(baseUrl!=null) retString+="&baseUrl="+URLEncoder.encode(baseUrl,"UTF-8");
129 | if(sentiment!=null) retString+="&sentiment="+(sentiment?"1":"0");
130 | }
131 | catch(UnsupportedEncodingException e ){
132 | retString = "";
133 | }
134 | return retString;
135 | }
136 |
137 | }
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_TargetedSentimentParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 |
3 | import java.io.UnsupportedEncodingException;
4 | import java.net.URLEncoder;
5 |
6 | public class AlchemyAPI_TargetedSentimentParams extends AlchemyAPI_Params {
7 |
8 | private Boolean showSourceText;
9 | private String target;
10 |
11 | public boolean isShowSourceText() {
12 | return showSourceText;
13 | }
14 |
15 | public void setShowSourceText(boolean showSourceText) {
16 | this.showSourceText = showSourceText;
17 | }
18 |
19 | public String getTarget(){
20 | return target;
21 | }
22 |
23 | public void setTarget(String target) {
24 | this.target = target;
25 | }
26 |
27 | public String getParameterString(){
28 | String retString = super.getParameterString();
29 | try{
30 | if(showSourceText!=null) retString+="&showSourceText="+(showSourceText?"1":"0");
31 | if(target!=null) retString+="&target="+URLEncoder.encode(target, "UTF-8");
32 |
33 | }
34 | catch(UnsupportedEncodingException e ){
35 | retString = "";
36 | }
37 |
38 | return retString;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_TaxonomyParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 | import java.net.URLEncoder;
3 | import java.io.UnsupportedEncodingException;
4 |
5 |
6 |
7 | public class AlchemyAPI_TaxonomyParams extends AlchemyAPI_Params{
8 | public static final String CLEANED_OR_RAW = "cleaned_or_raw";
9 | public static final String CLEANED = "cleaned";
10 | public static final String RAW = "raw";
11 | public static final String CQUERY = "cquery";
12 | public static final String XPATH = "xpath";
13 |
14 | private Boolean disambiguate;
15 | private Boolean linkedData;
16 | private Boolean coreference;
17 | private Boolean quotations;
18 | private String sourceText;
19 | private Boolean showSourceText;
20 | private String cQuery;
21 | private String xPath;
22 | private Integer maxRetrieve;
23 | private String baseUrl;
24 | private Boolean sentiment;
25 |
26 | public boolean isDisambiguate() {
27 | return disambiguate;
28 | }
29 | public void setDisambiguate(boolean disambiguate) {
30 | this.disambiguate = disambiguate;
31 | }
32 | public boolean isLinkedData() {
33 | return linkedData;
34 | }
35 | public void setLinkedData(boolean linkedData) {
36 | this.linkedData = linkedData;
37 | }
38 | public boolean isCoreference() {
39 | return coreference;
40 | }
41 | public void setCoreference(boolean coreference) {
42 | this.coreference = coreference;
43 | }
44 | public boolean isQuotations() {
45 | return quotations;
46 | }
47 | public void setQuotations(boolean quotations) {
48 | this.quotations = quotations;
49 | }
50 | public String getSourceText() {
51 | return sourceText;
52 | }
53 | public void setSourceText(String sourceText) {
54 | if( !sourceText.equals(AlchemyAPI_TaxonomyParams.CLEANED) && !sourceText.equals(AlchemyAPI_TaxonomyParams.CLEANED_OR_RAW)
55 | && !sourceText.equals(AlchemyAPI_TaxonomyParams.RAW) && !sourceText.equals(AlchemyAPI_TaxonomyParams.CQUERY)
56 | && !sourceText.equals(AlchemyAPI_TaxonomyParams.XPATH))
57 | {
58 | throw new RuntimeException("Invalid setting " + sourceText + " for parameter sourceText");
59 | }
60 | this.sourceText = sourceText;
61 | }
62 | public boolean isShowSourceText() {
63 | return showSourceText;
64 | }
65 | public void setShowSourceText(boolean showSourceText) {
66 | this.showSourceText = showSourceText;
67 | }
68 | public String getCQuery() {
69 | return cQuery;
70 | }
71 | public void setCQuery(String cQuery) {
72 | this.cQuery = cQuery;
73 | }
74 | public String getXPath() {
75 | return xPath;
76 | }
77 | public void setXPath(String xPath) {
78 | this.xPath = xPath;
79 | }
80 | public int getMaxRetrieve() {
81 | return maxRetrieve;
82 | }
83 | public void setMaxRetrieve(int maxRetrieve) {
84 | this.maxRetrieve = maxRetrieve;
85 | }
86 | public String getBaseUrl() {
87 | return baseUrl;
88 | }
89 | public void setBaseUrl(String baseUrl) {
90 | this.baseUrl = baseUrl;
91 | }
92 | public boolean isSentiment() {
93 | return sentiment;
94 | }
95 | public void setSentiment(boolean sentiment) {
96 | this.sentiment = sentiment;
97 | }
98 |
99 | public String getParameterString(){
100 | String retString = super.getParameterString();
101 | try{
102 | if(disambiguate!=null) retString+="&disambiguate="+(disambiguate ? "1":"0");
103 | if(linkedData!=null) retString+="&linkedData="+(linkedData?"1":"0");
104 | if(coreference!=null) retString+="&coreference="+(coreference?"1":"0");
105 | if(quotations!=null) retString+=""ations="+(quotations?"1":"0");
106 | if(sourceText!=null) retString+="&sourceText="+sourceText;
107 | if(showSourceText!=null) retString+="&showSourceText="+(showSourceText?"1":"0");
108 | if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
109 | if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
110 | if(maxRetrieve!=null) retString+="&maxRetrieve="+maxRetrieve.toString();
111 | if(baseUrl!=null) retString+="&baseUrl="+URLEncoder.encode(baseUrl,"UTF-8");
112 | if(sentiment!=null) retString+="&sentiment="+(sentiment?"1":"0");
113 | }
114 | catch(UnsupportedEncodingException e ){
115 | retString = "";
116 | }
117 | return retString;
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/api/AlchemyAPI_TextParams.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.api;
2 |
3 |
4 | public class AlchemyAPI_TextParams extends AlchemyAPI_Params{
5 | private Boolean useMetaData;
6 | private Boolean extractLinks;
7 |
8 | public boolean isUseMetaData() {
9 | return useMetaData;
10 | }
11 |
12 | public void setUseMetaData(boolean useMetaData) {
13 | this.useMetaData = useMetaData;
14 | }
15 |
16 | public boolean isExtractLinks() {
17 | return extractLinks;
18 | }
19 |
20 | public void setExtractLinks(boolean extractLinks) {
21 | this.extractLinks = extractLinks;
22 | }
23 |
24 | public String getParameterString(){
25 | String retString = super.getParameterString();
26 |
27 | if(useMetaData!=null) retString+="&useMetaData="+(useMetaData?"1":"0");
28 | if(extractLinks!=null) retString+="&extractLinks="+(extractLinks?"1":"0");
29 |
30 | return retString;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/AuthorTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.*;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 |
9 | import javax.xml.parsers.ParserConfigurationException;
10 | import javax.xml.xpath.XPathExpressionException;
11 | import javax.xml.transform.Transformer;
12 | import javax.xml.transform.TransformerException;
13 | import javax.xml.transform.TransformerFactory;
14 | import javax.xml.transform.dom.DOMSource;
15 | import javax.xml.transform.stream.StreamResult;
16 |
17 | public class AuthorTest {
18 |
19 |
20 | public static void main(String[] args)
21 | throws IOException, SAXException,
22 | ParserConfigurationException, XPathExpressionException
23 | {
24 | // Create an AlchemyAPI object.
25 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
26 |
27 | // Load a HTML document to analyze.
28 | String htmlDoc = getFileContents("data/example.html");
29 |
30 | Document doc = alchemyObj.URLGetAuthor("http://www.politico.com/blogs/media/2012/02/detroit-news-ed-upset-over-romney-edit-115247.html");
31 | System.out.println(getStringFromDocument(doc));
32 |
33 | doc = alchemyObj.HTMLGetAuthor(htmlDoc, "http://www.test.com/");
34 | System.out.println(getStringFromDocument(doc));
35 | }
36 |
37 | // utility function
38 | private static String getFileContents(String filename)
39 | throws IOException, FileNotFoundException
40 | {
41 | File file = new File(filename);
42 | StringBuilder contents = new StringBuilder();
43 |
44 | BufferedReader input = new BufferedReader(new FileReader(file));
45 |
46 | try {
47 | String line = null;
48 |
49 | while ((line = input.readLine()) != null) {
50 | contents.append(line);
51 | contents.append(System.getProperty("line.separator"));
52 | }
53 | } finally {
54 | input.close();
55 | }
56 |
57 | return contents.toString();
58 | }
59 |
60 | // utility method
61 | private static String getStringFromDocument(Document doc) {
62 | try {
63 | DOMSource domSource = new DOMSource(doc);
64 | StringWriter writer = new StringWriter();
65 | StreamResult result = new StreamResult(writer);
66 |
67 | TransformerFactory tf = TransformerFactory.newInstance();
68 | Transformer transformer = tf.newTransformer();
69 | transformer.transform(domSource, result);
70 |
71 | return writer.toString();
72 | } catch (TransformerException ex) {
73 | ex.printStackTrace();
74 | return null;
75 | }
76 | }
77 |
78 |
79 |
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/CategoryTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.*;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class CategoryTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Categorize a web URL by topic.
25 | Document doc = alchemyObj.URLGetCategory("http://www.techcrunch.com/");
26 | System.out.println(getStringFromDocument(doc));
27 |
28 | // Categorize some text.
29 | doc = alchemyObj.TextGetCategory("Latest on the War in Iraq.");
30 | System.out.println(getStringFromDocument(doc));
31 |
32 | // Load a HTML document to analyze.
33 | String htmlDoc = getFileContents("data/example.html");
34 |
35 | // Categorize a HTML document by topic.
36 | doc = alchemyObj.HTMLGetCategory(htmlDoc, "http://www.test.com/");
37 | System.out.println(getStringFromDocument(doc));
38 |
39 | AlchemyAPI_CategoryParams categoryParams = new AlchemyAPI_CategoryParams();
40 | categoryParams.setOutputMode(AlchemyAPI_Params.OUTPUT_RDF);
41 | doc = alchemyObj.HTMLGetCategory(htmlDoc, "http://www.test.com/", categoryParams);
42 | System.out.println(getStringFromDocument(doc));
43 | }
44 |
45 | // utility function
46 | private static String getFileContents(String filename)
47 | throws IOException, FileNotFoundException
48 | {
49 | File file = new File(filename);
50 | StringBuilder contents = new StringBuilder();
51 |
52 | BufferedReader input = new BufferedReader(new FileReader(file));
53 |
54 | try {
55 | String line = null;
56 |
57 | while ((line = input.readLine()) != null) {
58 | contents.append(line);
59 | contents.append(System.getProperty("line.separator"));
60 | }
61 | } finally {
62 | input.close();
63 | }
64 |
65 | return contents.toString();
66 | }
67 |
68 | // utility method
69 | private static String getStringFromDocument(Document doc) {
70 | try {
71 | DOMSource domSource = new DOMSource(doc);
72 | StringWriter writer = new StringWriter();
73 | StreamResult result = new StreamResult(writer);
74 |
75 | TransformerFactory tf = TransformerFactory.newInstance();
76 | Transformer transformer = tf.newTransformer();
77 | transformer.transform(domSource, result);
78 |
79 | return writer.toString();
80 | } catch (TransformerException ex) {
81 | ex.printStackTrace();
82 | return null;
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/CombinedTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.*;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class CombinedTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Extract combined data for a web URL.
25 | Document doc = alchemyObj.URLGetCombined("http://www.techcrunch.com/");
26 | System.out.println(getStringFromDocument(doc));
27 |
28 | // Extract combined data from a text string.
29 | doc = alchemyObj.TextGetCombined(
30 | "Hello there, my name is Bob Jones. I live in the United States of America. " +
31 | "Where do you live, Fred?");
32 | System.out.println(getStringFromDocument(doc));
33 |
34 | // Only extract entities & keywords
35 | AlchemyAPI_CombinedParams combinedParams = new AlchemyAPI_CombinedParams();
36 | combinedParams.setSentiment(true);
37 | combinedParams.setExtract("entity");
38 | combinedParams.setExtract("keyword");
39 | doc = alchemyObj.TextGetCombined("Madonna enjoys tasty Pepsi. I love her style.", combinedParams);
40 | System.out.println(getStringFromDocument(doc));
41 | }
42 |
43 | // utility function
44 | private static String getFileContents(String filename)
45 | throws IOException, FileNotFoundException
46 | {
47 | File file = new File(filename);
48 | StringBuilder contents = new StringBuilder();
49 |
50 | BufferedReader input = new BufferedReader(new FileReader(file));
51 |
52 | try {
53 | String line = null;
54 |
55 | while ((line = input.readLine()) != null) {
56 | contents.append(line);
57 | contents.append(System.getProperty("line.separator"));
58 | }
59 | } finally {
60 | input.close();
61 | }
62 |
63 | return contents.toString();
64 | }
65 |
66 | // utility method
67 | private static String getStringFromDocument(Document doc) {
68 | try {
69 | DOMSource domSource = new DOMSource(doc);
70 | StringWriter writer = new StringWriter();
71 | StreamResult result = new StreamResult(writer);
72 |
73 | TransformerFactory tf = TransformerFactory.newInstance();
74 | Transformer transformer = tf.newTransformer();
75 | transformer.transform(domSource, result);
76 |
77 | return writer.toString();
78 | } catch (TransformerException ex) {
79 | ex.printStackTrace();
80 | return null;
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/ConceptTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.AlchemyAPI;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class ConceptTest {
17 | public static void main(String[] args) throws IOException, SAXException,
18 | ParserConfigurationException, XPathExpressionException {
19 | // Create an AlchemyAPI object.
20 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
21 |
22 | // Extract concept tags for a web URL.
23 | Document doc = alchemyObj.URLGetRankedConcepts("http://www.techcrunch.com/");
24 | System.out.println(getStringFromDocument(doc));
25 |
26 | // Extract concept tags for a text string.
27 | doc = alchemyObj.TextGetRankedConcepts(
28 | "This thing has a steering wheel, tires, and an engine. Do you know what it is?");
29 | System.out.println(getStringFromDocument(doc));
30 |
31 | // Load a HTML document to analyze.
32 | String htmlDoc = getFileContents("data/example.html");
33 |
34 | // Extract concept tags for a HTML document.
35 | doc = alchemyObj.HTMLGetRankedConcepts(htmlDoc, "http://www.test.com/");
36 | System.out.println(getStringFromDocument(doc));
37 | }
38 |
39 | // utility function
40 | private static String getFileContents(String filename)
41 | throws IOException, FileNotFoundException
42 | {
43 | File file = new File(filename);
44 | StringBuilder contents = new StringBuilder();
45 |
46 | BufferedReader input = new BufferedReader(new FileReader(file));
47 |
48 | try {
49 | String line = null;
50 |
51 | while ((line = input.readLine()) != null) {
52 | contents.append(line);
53 | contents.append(System.getProperty("line.separator"));
54 | }
55 | } finally {
56 | input.close();
57 | }
58 |
59 | return contents.toString();
60 | }
61 |
62 | // utility method
63 | private static String getStringFromDocument(Document doc) {
64 | try {
65 | DOMSource domSource = new DOMSource(doc);
66 | StringWriter writer = new StringWriter();
67 | StreamResult result = new StreamResult(writer);
68 |
69 | TransformerFactory tf = TransformerFactory.newInstance();
70 | Transformer transformer = tf.newTransformer();
71 | transformer.transform(domSource, result);
72 |
73 | return writer.toString();
74 | } catch (TransformerException ex) {
75 | ex.printStackTrace();
76 | return null;
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/ConstraintQueryTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.AlchemyAPI;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class ConstraintQueryTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Extract first link from an URL.
25 | Document doc = alchemyObj.URLGetConstraintQuery("http://microformats.org/wiki/hcard",
26 | "1st link");
27 | System.out.println(getStringFromDocument(doc));
28 |
29 | // Extract first link from a HTML.
30 | String htmlDoc = getFileContents("data/example.html");
31 | doc = alchemyObj.HTMLGetConstraintQuery(htmlDoc, "http://www.test.com/", "1st link");
32 | System.out.println(getStringFromDocument(doc));
33 | }
34 |
35 | // utility function
36 | private static String getFileContents(String filename)
37 | throws IOException, FileNotFoundException
38 | {
39 | File file = new File(filename);
40 | StringBuilder contents = new StringBuilder();
41 |
42 | BufferedReader input = new BufferedReader(new FileReader(file));
43 |
44 | try {
45 | String line = null;
46 |
47 | while ((line = input.readLine()) != null) {
48 | contents.append(line);
49 | contents.append(System.getProperty("line.separator"));
50 | }
51 | } finally {
52 | input.close();
53 | }
54 |
55 | return contents.toString();
56 | }
57 |
58 | // utility method
59 | private static String getStringFromDocument(Document doc) {
60 | try {
61 | DOMSource domSource = new DOMSource(doc);
62 | StringWriter writer = new StringWriter();
63 | StreamResult result = new StreamResult(writer);
64 |
65 | TransformerFactory tf = TransformerFactory.newInstance();
66 | Transformer transformer = tf.newTransformer();
67 | transformer.transform(domSource, result);
68 |
69 | return writer.toString();
70 | } catch (TransformerException ex) {
71 | ex.printStackTrace();
72 | return null;
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/EntityTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.AlchemyAPI;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class EntityTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Extract a ranked list of named entities for a web URL.
25 | Document doc = alchemyObj.URLGetRankedNamedEntities("http://www.techcrunch.com/");
26 | System.out.println(getStringFromDocument(doc));
27 |
28 | // Extract a ranked list of named entities from a text string.
29 | doc = alchemyObj.TextGetRankedNamedEntities(
30 | "Hello there, my name is Bob Jones. I live in the United States of America. " +
31 | "Where do you live, Fred?");
32 | System.out.println(getStringFromDocument(doc));
33 |
34 | // Load a HTML document to analyze.
35 | String htmlDoc = getFileContents("data/example.html");
36 |
37 | // Extract a ranked list of named entities from a HTML document.
38 | doc = alchemyObj.HTMLGetRankedNamedEntities(htmlDoc, "http://www.test.com/");
39 | System.out.println(getStringFromDocument(doc));
40 | }
41 |
42 | // utility function
43 | private static String getFileContents(String filename)
44 | throws IOException, FileNotFoundException
45 | {
46 | File file = new File(filename);
47 | StringBuilder contents = new StringBuilder();
48 |
49 | BufferedReader input = new BufferedReader(new FileReader(file));
50 |
51 | try {
52 | String line = null;
53 |
54 | while ((line = input.readLine()) != null) {
55 | contents.append(line);
56 | contents.append(System.getProperty("line.separator"));
57 | }
58 | } finally {
59 | input.close();
60 | }
61 |
62 | return contents.toString();
63 | }
64 |
65 | // utility method
66 | private static String getStringFromDocument(Document doc) {
67 | try {
68 | DOMSource domSource = new DOMSource(doc);
69 | StringWriter writer = new StringWriter();
70 | StreamResult result = new StreamResult(writer);
71 |
72 | TransformerFactory tf = TransformerFactory.newInstance();
73 | Transformer transformer = tf.newTransformer();
74 | transformer.transform(domSource, result);
75 |
76 | return writer.toString();
77 | } catch (TransformerException ex) {
78 | ex.printStackTrace();
79 | return null;
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/FeedLinksTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.AlchemyAPI;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class FeedLinksTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Extract RSS / ATOM feed links from a web URL.
25 | Document doc = alchemyObj.URLGetFeedLinks("http://www.techcrunch.com/");
26 | System.out.println(getStringFromDocument(doc));
27 |
28 | // Load a HTML document to analyze.
29 | String htmlDoc = getFileContents("data/example.html");
30 |
31 | // Extract RSS / ATOM feed links from a HTML document.
32 | doc = alchemyObj.HTMLGetFeedLinks(htmlDoc, "http://www.test.com/");
33 | System.out.println(getStringFromDocument(doc));
34 | }
35 |
36 | // utility function
37 | private static String getFileContents(String filename)
38 | throws IOException, FileNotFoundException
39 | {
40 | File file = new File(filename);
41 | StringBuilder contents = new StringBuilder();
42 |
43 | BufferedReader input = new BufferedReader(new FileReader(file));
44 |
45 | try {
46 | String line = null;
47 |
48 | while ((line = input.readLine()) != null) {
49 | contents.append(line);
50 | contents.append(System.getProperty("line.separator"));
51 | }
52 | } finally {
53 | input.close();
54 | }
55 |
56 | return contents.toString();
57 | }
58 |
59 | // utility method
60 | private static String getStringFromDocument(Document doc) {
61 | try {
62 | DOMSource domSource = new DOMSource(doc);
63 | StringWriter writer = new StringWriter();
64 | StreamResult result = new StreamResult(writer);
65 |
66 | TransformerFactory tf = TransformerFactory.newInstance();
67 | Transformer transformer = tf.newTransformer();
68 | transformer.transform(domSource, result);
69 |
70 | return writer.toString();
71 | } catch (TransformerException ex) {
72 | ex.printStackTrace();
73 | return null;
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/ImageTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.*;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class ImageTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Extract image for a web URL.
25 | Document doc = alchemyObj.URLGetImage("http://www.techcrunch.com/");
26 | System.out.println(getStringFromDocument(doc));
27 | }
28 |
29 | // utility function
30 | private static String getFileContents(String filename)
31 | throws IOException, FileNotFoundException
32 | {
33 | File file = new File(filename);
34 | StringBuilder contents = new StringBuilder();
35 |
36 | BufferedReader input = new BufferedReader(new FileReader(file));
37 |
38 | try {
39 | String line = null;
40 |
41 | while ((line = input.readLine()) != null) {
42 | contents.append(line);
43 | contents.append(System.getProperty("line.separator"));
44 | }
45 | } finally {
46 | input.close();
47 | }
48 |
49 | return contents.toString();
50 | }
51 |
52 | // utility method
53 | private static String getStringFromDocument(Document doc) {
54 | try {
55 | DOMSource domSource = new DOMSource(doc);
56 | StringWriter writer = new StringWriter();
57 | StreamResult result = new StreamResult(writer);
58 |
59 | TransformerFactory tf = TransformerFactory.newInstance();
60 | Transformer transformer = tf.newTransformer();
61 | transformer.transform(domSource, result);
62 |
63 | return writer.toString();
64 | } catch (TransformerException ex) {
65 | ex.printStackTrace();
66 | return null;
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/KeywordTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.AlchemyAPI;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class KeywordTest {
17 | public static void main(String[] args) throws IOException, SAXException,
18 | ParserConfigurationException, XPathExpressionException {
19 | // Create an AlchemyAPI object.
20 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
21 |
22 | // Extract topic keywords for a web URL.
23 | Document doc = alchemyObj.URLGetRankedKeywords("http://www.techcrunch.com/");
24 | System.out.println(getStringFromDocument(doc));
25 |
26 | // Extract topic keywords for a text string.
27 | doc = alchemyObj.TextGetRankedKeywords(
28 | "Hello there, my name is Bob Jones. I live in the United States of America. " +
29 | "Where do you live, Fred?");
30 | System.out.println(getStringFromDocument(doc));
31 |
32 | // Load a HTML document to analyze.
33 | String htmlDoc = getFileContents("data/example.html");
34 |
35 | // Extract topic keywords for a HTML document.
36 | doc = alchemyObj.HTMLGetRankedKeywords(htmlDoc, "http://www.test.com/");
37 | System.out.println(getStringFromDocument(doc));
38 | }
39 |
40 | // utility function
41 | private static String getFileContents(String filename)
42 | throws IOException, FileNotFoundException
43 | {
44 | File file = new File(filename);
45 | StringBuilder contents = new StringBuilder();
46 |
47 | BufferedReader input = new BufferedReader(new FileReader(file));
48 |
49 | try {
50 | String line = null;
51 |
52 | while ((line = input.readLine()) != null) {
53 | contents.append(line);
54 | contents.append(System.getProperty("line.separator"));
55 | }
56 | } finally {
57 | input.close();
58 | }
59 |
60 | return contents.toString();
61 | }
62 |
63 | // utility method
64 | private static String getStringFromDocument(Document doc) {
65 | try {
66 | DOMSource domSource = new DOMSource(doc);
67 | StringWriter writer = new StringWriter();
68 | StreamResult result = new StreamResult(writer);
69 |
70 | TransformerFactory tf = TransformerFactory.newInstance();
71 | Transformer transformer = tf.newTransformer();
72 | transformer.transform(domSource, result);
73 |
74 | return writer.toString();
75 | } catch (TransformerException ex) {
76 | ex.printStackTrace();
77 | return null;
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/LanguageTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.AlchemyAPI;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class LanguageTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Detect the language for a web URL.
25 | Document doc = alchemyObj.URLGetLanguage("http://news.google.fr/");
26 | System.out.println(getStringFromDocument(doc));
27 |
28 | // Detect the language for a text string (requires at least 100
29 | // characters).
30 | String htmlDoc = getFileContents("data/example.html");
31 | doc = alchemyObj.TextGetLanguage("This is some english language text. What language do you speak?");
32 | System.out.println(getStringFromDocument(doc));
33 |
34 | // Load a HTML document to analyze.
35 | htmlDoc = getFileContents("data/example.html");
36 |
37 | // Detect the language for a HTML document.
38 | doc = alchemyObj.HTMLGetLanguage(htmlDoc, "http://www.test.com/");
39 | System.out.println(getStringFromDocument(doc));
40 | }
41 |
42 | // utility function
43 | private static String getFileContents(String filename) throws IOException,
44 | FileNotFoundException {
45 | File file = new File(filename);
46 | StringBuilder contents = new StringBuilder();
47 |
48 | BufferedReader input = new BufferedReader(new FileReader(file));
49 |
50 | try {
51 | String line = null;
52 |
53 | while ((line = input.readLine()) != null) {
54 | contents.append(line);
55 | contents.append(System.getProperty("line.separator"));
56 | }
57 | } finally {
58 | input.close();
59 | }
60 |
61 | return contents.toString();
62 | }
63 |
64 | // utility method
65 | private static String getStringFromDocument(Document doc) {
66 | try {
67 | DOMSource domSource = new DOMSource(doc);
68 | StringWriter writer = new StringWriter();
69 | StreamResult result = new StreamResult(writer);
70 |
71 | TransformerFactory tf = TransformerFactory.newInstance();
72 | Transformer transformer = tf.newTransformer();
73 | transformer.transform(domSource, result);
74 |
75 | return writer.toString();
76 | } catch (TransformerException ex) {
77 | ex.printStackTrace();
78 | return null;
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/MicroformatTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.AlchemyAPI;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class MicroformatsTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Extract microformats data from a web URL.
25 | Document doc = alchemyObj.URLGetMicroformats("http://microformats.org/wiki/hcard");
26 | System.out.println(getStringFromDocument(doc));
27 |
28 | // Load a HTML document to analyze.
29 | String htmlDoc = getFileContents("data/microformats.html");
30 |
31 | // Extract microformats data from a HTML document.
32 | doc = alchemyObj.HTMLGetMicroformats(htmlDoc, "http://www.test.com/");
33 | System.out.println(getStringFromDocument(doc));
34 | }
35 |
36 | // utility function
37 | private static String getFileContents(String filename)
38 | throws IOException, FileNotFoundException
39 | {
40 | File file = new File(filename);
41 | StringBuilder contents = new StringBuilder();
42 |
43 | BufferedReader input = new BufferedReader(new FileReader(file));
44 |
45 | try {
46 | String line = null;
47 |
48 | while ((line = input.readLine()) != null) {
49 | contents.append(line);
50 | contents.append(System.getProperty("line.separator"));
51 | }
52 | } finally {
53 | input.close();
54 | }
55 |
56 | return contents.toString();
57 | }
58 |
59 | // utility method
60 | private static String getStringFromDocument(Document doc) {
61 | try {
62 | DOMSource domSource = new DOMSource(doc);
63 | StringWriter writer = new StringWriter();
64 | StreamResult result = new StreamResult(writer);
65 |
66 | TransformerFactory tf = TransformerFactory.newInstance();
67 | Transformer transformer = tf.newTransformer();
68 | transformer.transform(domSource, result);
69 |
70 | return writer.toString();
71 | } catch (TransformerException ex) {
72 | ex.printStackTrace();
73 | return null;
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/ParameterTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.*;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class ParameterTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Extract a ranked list of named entities for a web URL. Turn off disambiguation
25 | AlchemyAPI_NamedEntityParams entityParams = new AlchemyAPI_NamedEntityParams();
26 | entityParams.setDisambiguate(false);
27 | entityParams.setSentiment(true);
28 | Document doc = alchemyObj.URLGetRankedNamedEntities("http://www.techcrunch.com/", entityParams);
29 | System.out.println(getStringFromDocument(doc));
30 |
31 | // Extract a ranked list of named entities from a text string.
32 | doc = alchemyObj.TextGetRankedNamedEntities(
33 | "Hello there, my name is Bob Jones. I live in the United States of America. " +
34 | "Where do you live, Fred?", entityParams);
35 | System.out.println(getStringFromDocument(doc));
36 |
37 | // Load a HTML document to analyze.
38 | String htmlDoc = getFileContents("data/example.html");
39 |
40 | // Extract a ranked list of named entities from a HTML document.
41 | doc = alchemyObj.HTMLGetRankedNamedEntities(htmlDoc, "http://www.test.com/", entityParams);
42 | System.out.println(getStringFromDocument(doc));
43 |
44 | }
45 |
46 | // utility function
47 | private static String getFileContents(String filename)
48 | throws IOException, FileNotFoundException
49 | {
50 | File file = new File(filename);
51 | StringBuilder contents = new StringBuilder();
52 |
53 | BufferedReader input = new BufferedReader(new FileReader(file));
54 |
55 | try {
56 | String line = null;
57 |
58 | while ((line = input.readLine()) != null) {
59 | contents.append(line);
60 | contents.append(System.getProperty("line.separator"));
61 | }
62 | } finally {
63 | input.close();
64 | }
65 |
66 | return contents.toString();
67 | }
68 |
69 | // utility method
70 | private static String getStringFromDocument(Document doc) {
71 | try {
72 | DOMSource domSource = new DOMSource(doc);
73 | StringWriter writer = new StringWriter();
74 | StreamResult result = new StreamResult(writer);
75 |
76 | TransformerFactory tf = TransformerFactory.newInstance();
77 | Transformer transformer = tf.newTransformer();
78 | transformer.transform(domSource, result);
79 |
80 | return writer.toString();
81 | } catch (TransformerException ex) {
82 | ex.printStackTrace();
83 | return null;
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/RelationsTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.*;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class RelationsTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Extract a ranked list of relations for a web URL.
25 | Document doc = alchemyObj.URLGetRelations("http://www.techcrunch.com/");
26 | System.out.println(getStringFromDocument(doc));
27 |
28 | // Extract a ranked list of relations from a text string.
29 | doc = alchemyObj.TextGetRelations(
30 | "Hello there, my name is Bob Jones. I live in the United States of America. " +
31 | "Where do you live, Fred?");
32 | System.out.println(getStringFromDocument(doc));
33 |
34 | // Load a HTML document to analyze.
35 | String htmlDoc = getFileContents("data/example.html");
36 |
37 | // Extract a ranked list of relations from a HTML document.
38 | doc = alchemyObj.HTMLGetRelations(htmlDoc, "http://www.test.com/");
39 | System.out.println(getStringFromDocument(doc));
40 |
41 | AlchemyAPI_RelationParams relationParams = new AlchemyAPI_RelationParams();
42 | relationParams.setSentiment(true);
43 | relationParams.setEntities(true);
44 | relationParams.setDisambiguate(true);
45 | relationParams.setSentimentExcludeEntities(true);
46 | doc = alchemyObj.TextGetRelations("Madonna enjoys tasty Pepsi. I love her style.", relationParams);
47 | System.out.println(getStringFromDocument(doc));
48 |
49 | relationParams.setSentiment(true);
50 | relationParams.setRequireEntities(true);
51 | relationParams.setSentimentExcludeEntities(true);
52 | doc = alchemyObj.TextGetRelations("Madonna enjoys tasty Pepsi. I love her style.", relationParams);
53 | System.out.println(getStringFromDocument(doc));
54 | }
55 |
56 | // utility function
57 | private static String getFileContents(String filename)
58 | throws IOException, FileNotFoundException
59 | {
60 | File file = new File(filename);
61 | StringBuilder contents = new StringBuilder();
62 |
63 | BufferedReader input = new BufferedReader(new FileReader(file));
64 |
65 | try {
66 | String line = null;
67 |
68 | while ((line = input.readLine()) != null) {
69 | contents.append(line);
70 | contents.append(System.getProperty("line.separator"));
71 | }
72 | } finally {
73 | input.close();
74 | }
75 |
76 | return contents.toString();
77 | }
78 |
79 | // utility method
80 | private static String getStringFromDocument(Document doc) {
81 | try {
82 | DOMSource domSource = new DOMSource(doc);
83 | StringWriter writer = new StringWriter();
84 | StreamResult result = new StreamResult(writer);
85 |
86 | TransformerFactory tf = TransformerFactory.newInstance();
87 | Transformer transformer = tf.newTransformer();
88 | transformer.transform(domSource, result);
89 |
90 | return writer.toString();
91 | } catch (TransformerException ex) {
92 | ex.printStackTrace();
93 | return null;
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/SentimentTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.AlchemyAPI;
4 | import com.alchemyapi.api.*;
5 |
6 | import org.xml.sax.SAXException;
7 | import org.w3c.dom.Document;
8 | import java.io.*;
9 | import javax.xml.parsers.ParserConfigurationException;
10 | import javax.xml.xpath.XPathExpressionException;
11 | import javax.xml.transform.Transformer;
12 | import javax.xml.transform.TransformerException;
13 | import javax.xml.transform.TransformerFactory;
14 | import javax.xml.transform.dom.DOMSource;
15 | import javax.xml.transform.stream.StreamResult;
16 |
17 | class SentimentTest {
18 | public static void main(String[] args) throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException {
20 | // Create an AlchemyAPI object.
21 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
22 |
23 | // Extract sentiment for a web URL.
24 | Document doc = alchemyObj.URLGetTextSentiment("http://www.techcrunch.com/");
25 | System.out.println(getStringFromDocument(doc));
26 |
27 | // Extract sentiment for a text string.
28 | doc = alchemyObj.TextGetTextSentiment(
29 | "That hat is ridiculous, Charles.");
30 | System.out.println(getStringFromDocument(doc));
31 |
32 | // Load a HTML document to analyze.
33 | String htmlDoc = getFileContents("data/example.html");
34 |
35 | // Extract sentiment for a HTML document.
36 | doc = alchemyObj.HTMLGetTextSentiment(htmlDoc, "http://www.test.com/");
37 | System.out.println(getStringFromDocument(doc));
38 |
39 | // Extract entity-targeted sentiment from a HTML document.
40 | AlchemyAPI_NamedEntityParams entityParams = new AlchemyAPI_NamedEntityParams();
41 | entityParams.setSentiment(true);
42 | doc = alchemyObj.TextGetRankedNamedEntities("That Mike Tyson is such a sweetheart.", entityParams);
43 | System.out.println(getStringFromDocument(doc));
44 |
45 | // Extract keyword-targeted sentiment from a HTML document.
46 | AlchemyAPI_KeywordParams keywordParams = new AlchemyAPI_KeywordParams();
47 | keywordParams.setSentiment(true);
48 | doc = alchemyObj.TextGetRankedKeywords("That Mike Tyson is such a sweetheart.", keywordParams);
49 | System.out.println(getStringFromDocument(doc));
50 |
51 | //Extract Targeted Sentiment from text
52 | AlchemyAPI_TargetedSentimentParams sentimentParams = new AlchemyAPI_TargetedSentimentParams();
53 | sentimentParams.setShowSourceText(true);
54 | doc = alchemyObj.TextGetTargetedSentiment("This car is terrible.", "car", sentimentParams);
55 | System.out.print(getStringFromDocument(doc));
56 |
57 | //Extract Targeted Sentiment from url
58 | doc = alchemyObj.URLGetTargetedSentiment("http://techcrunch.com/2012/03/01/keen-on-anand-rajaraman-how-walmart-wants-to-leapfrog-over-amazon-tctv/", "Walmart",sentimentParams);
59 | System.out.print(getStringFromDocument(doc));
60 |
61 | //Extract Targeted Sentiment from html
62 | doc = alchemyObj.HTMLGetTargetedSentiment(htmlDoc, "http://www.test.com/", "WujWuj", sentimentParams);
63 | System.out.print(getStringFromDocument(doc));
64 | }
65 |
66 | // utility function
67 | private static String getFileContents(String filename)
68 | throws IOException, FileNotFoundException
69 | {
70 | File file = new File(filename);
71 | StringBuilder contents = new StringBuilder();
72 |
73 | BufferedReader input = new BufferedReader(new FileReader(file));
74 |
75 | try {
76 | String line = null;
77 |
78 | while ((line = input.readLine()) != null) {
79 | contents.append(line);
80 | contents.append(System.getProperty("line.separator"));
81 | }
82 | } finally {
83 | input.close();
84 | }
85 |
86 | return contents.toString();
87 | }
88 |
89 | // utility method
90 | private static String getStringFromDocument(Document doc) {
91 | try {
92 | DOMSource domSource = new DOMSource(doc);
93 | StringWriter writer = new StringWriter();
94 | StreamResult result = new StreamResult(writer);
95 |
96 | TransformerFactory tf = TransformerFactory.newInstance();
97 | Transformer transformer = tf.newTransformer();
98 | transformer.transform(domSource, result);
99 |
100 | return writer.toString();
101 | } catch (TransformerException ex) {
102 | ex.printStackTrace();
103 | return null;
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/TaxonomyTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.*;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class TaxonomyTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Extract a ranked list of relations for a web URL.
25 | Document doc = alchemyObj.URLGetTaxonomy("http://www.techcrunch.com/");
26 | System.out.println(getStringFromDocument(doc));
27 |
28 | // Extract a ranked taxonomy from a text string.
29 | doc = alchemyObj.TextGetTaxonomy(
30 | "Hello there, my name is Bob Jones. I live in the United States of America. " +
31 | "Where do you live, Fred?");
32 | System.out.println(getStringFromDocument(doc));
33 |
34 | // Load a HTML document to analyze.
35 | String htmlDoc = getFileContents("data/example.html");
36 |
37 | // Extract a ranked taxonomy from a HTML document.
38 | doc = alchemyObj.HTMLGetTaxonomy(htmlDoc, "http://www.test.com/");
39 | System.out.println(getStringFromDocument(doc));
40 | }
41 |
42 | // utility function
43 | private static String getFileContents(String filename)
44 | throws IOException, FileNotFoundException
45 | {
46 | File file = new File(filename);
47 | StringBuilder contents = new StringBuilder();
48 |
49 | BufferedReader input = new BufferedReader(new FileReader(file));
50 |
51 | try {
52 | String line = null;
53 |
54 | while ((line = input.readLine()) != null) {
55 | contents.append(line);
56 | contents.append(System.getProperty("line.separator"));
57 | }
58 | } finally {
59 | input.close();
60 | }
61 |
62 | return contents.toString();
63 | }
64 |
65 | // utility method
66 | private static String getStringFromDocument(Document doc) {
67 | try {
68 | DOMSource domSource = new DOMSource(doc);
69 | StringWriter writer = new StringWriter();
70 | StreamResult result = new StreamResult(writer);
71 |
72 | TransformerFactory tf = TransformerFactory.newInstance();
73 | Transformer transformer = tf.newTransformer();
74 | transformer.transform(domSource, result);
75 |
76 | return writer.toString();
77 | } catch (TransformerException ex) {
78 | ex.printStackTrace();
79 | return null;
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/src/com/alchemyapi/test/TextExtractTest.java:
--------------------------------------------------------------------------------
1 | package com.alchemyapi.test;
2 |
3 | import com.alchemyapi.api.AlchemyAPI;
4 |
5 | import org.xml.sax.SAXException;
6 | import org.w3c.dom.Document;
7 | import java.io.*;
8 | import javax.xml.parsers.ParserConfigurationException;
9 | import javax.xml.xpath.XPathExpressionException;
10 | import javax.xml.transform.Transformer;
11 | import javax.xml.transform.TransformerException;
12 | import javax.xml.transform.TransformerFactory;
13 | import javax.xml.transform.dom.DOMSource;
14 | import javax.xml.transform.stream.StreamResult;
15 |
16 | class TextExtractTest {
17 | public static void main(String[] args)
18 | throws IOException, SAXException,
19 | ParserConfigurationException, XPathExpressionException
20 | {
21 | // Create an AlchemyAPI object.
22 | AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
23 |
24 | // Extract page text from a web URL. (ignoring ads, navigation links,
25 | // and other content).
26 | Document doc = alchemyObj.URLGetText("http://www.techcrunch.com/");
27 | System.out.println(getStringFromDocument(doc));
28 |
29 | // Extract raw page text from a web URL. (including ads, navigation
30 | // links, and other content).
31 | doc = alchemyObj.URLGetRawText("http://www.techcrunch.com/");
32 | System.out.println(getStringFromDocument(doc));
33 |
34 | // Extract a title from a web URL.
35 | doc = alchemyObj.URLGetTitle("http://www.techcrunch.com/");
36 | System.out.println(getStringFromDocument(doc));
37 |
38 | // Load a HTML document to analyze.
39 | String htmlDoc = getFileContents("data/example.html");
40 |
41 | // Extract page text from a HTML document. (ignoring ads, navigation
42 | // links, and other content).
43 | doc = alchemyObj.HTMLGetText(htmlDoc, "http://www.test.com/");
44 | System.out.println(getStringFromDocument(doc));
45 |
46 | // Extract raw page text from a HTML document. (including ads,
47 | // navigation links, and other content).
48 | doc = alchemyObj.HTMLGetRawText(htmlDoc, "http://www.test.com/");
49 | System.out.println(getStringFromDocument(doc));
50 |
51 | // Extract a title from a HTML document.
52 | doc = alchemyObj.HTMLGetTitle(htmlDoc, "http://www.test.com/");
53 | System.out.println(getStringFromDocument(doc));
54 | }
55 |
56 | // utility function
57 | private static String getFileContents(String filename)
58 | throws IOException, FileNotFoundException
59 | {
60 | File file = new File(filename);
61 | StringBuilder contents = new StringBuilder();
62 |
63 | BufferedReader input = new BufferedReader(new FileReader(file));
64 |
65 | try {
66 | String line = null;
67 |
68 | while ((line = input.readLine()) != null) {
69 | contents.append(line);
70 | contents.append(System.getProperty("line.separator"));
71 | }
72 | } finally {
73 | input.close();
74 | }
75 |
76 | return contents.toString();
77 | }
78 |
79 | // utility method
80 | private static String getStringFromDocument(Document doc) {
81 | try {
82 | DOMSource domSource = new DOMSource(doc);
83 | StringWriter writer = new StringWriter();
84 | StreamResult result = new StreamResult(writer);
85 |
86 | TransformerFactory tf = TransformerFactory.newInstance();
87 | Transformer transformer = tf.newTransformer();
88 | transformer.transform(domSource, result);
89 |
90 | return writer.toString();
91 | } catch (TransformerException ex) {
92 | ex.printStackTrace();
93 | return null;
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/testdir/api_key.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ColdSauce/Captor/c63a3d317dae9cc38a3e6d4ea217dfea8a96b1c6/app/libs/AlchemyAPI_Java-0.9/testdir/api_key.txt
--------------------------------------------------------------------------------
/app/libs/AlchemyAPI_Java-0.9/testdir/data/example2_nolinks.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | b> John P. Avlon is a CNN contributor and senior political columnist for The Daily Beast. He is the author of "Wingnuts: How the Lunatic Fringe is Hijacking America."
4 | New York (CNN) -- In a time of voter anger at unsustainable government spending and Washington hypocrisy, here's a story that should get your blood up.
5 | Last week, the House of Representatives considered eliminating a nearly half-billion dollar earmark that was snuck into a defense authorization bill. But members of both parties
6 | voted to keep the corporate pork in the bill -- despite a supposed moratorium on earmarks and despite that the Pentagon has repeatedly said it doesn't want the money.
Only in
7 | Washington would bureaucracy be force-fed a project it doesn't want or need.
But so far, we haven't seen this contempt for taxpayer dollars make its way to protest signs or
8 | talk radio driven talking points. That's because President Obama opposes the earmark and the Republican congressional leadership voted for it.
This doesn't fit neatly into the
9 | hyperpartisan narrative of screaming about socialism -- in which Republicans bewail overspending by Democrats -- but it's a perfect illustration of how deep the dysfunction is in Washington.
10 |
At issue is the alternate engine for the Joint Strike Fighter platform, a corporate subsidized boondoggle that has cost taxpayers $1.2 billion in earmarks since 2004. It is
11 | estimated to cost at least $2.9 billion more until its completion.
Defenders argue that paying GE and Rolls Royce to develop a second engine for Air Force fighters will stimulate
12 | competition in the defense industry and bring down costs in the long run while protecting jobs in the short run.
Critics point out that crony capitalism can't create a true free
13 | market in the defense industry -- it's the equivalent of diet hucksters who claim you can eat yourself fitter. This is about money: pork barrel politics hiding under the noble banner of
14 | national defense.
Here's how the sordid story unfolded:
An anonymous earmark was added to the defense authorization bill, requesting $485 million in new funds for the
15 | alternate engine program, despite a much-ballyhooed moratorium on earmarks going to for-profit entities (agreed to by Democrats), and a total ban on earmark requests agreed to by
16 | Republicans for fiscal year 2011.
In reaction, a small bipartisan group of members of Congress -- led by Democrat Chellie Pingree of Maine and Republican Tom Rooney of Florida,
17 | joined by Democrat John Larson of Connecticut and Republican Lynn Westmoreland of Georgia -- proposed an amendment to strip the bill of the ugly anonymous earmark. Their principled stand
18 | went down to defeat by a vote of 193 to 231.
It's no surprise that in a recession, the congressional representatives of Ohio and Indiana would vote to keep the earmark subsidy in the
19 | bill, including the normally stalwart fiscal conservative Mike Pence of Indiana. Those states are benefiting most from the development of the engines in terms of jobs on the ground.
What's
20 | more surprising is why so many of their colleagues would climb on this pork-barrel bandwagon, including the Republican congressional leadership led by John Boehner and Eric Cantor, who are
21 | trying to build the midterm election campaign around a promise to restore fiscal discipline.
That selling job that should be even tougher since a majority of Democrats voted to kill
22 | the alternate engine and a majority of Republicans voted to keep it going.
"This was the first big earmark test for 2010, and Congress failed," said Thomas A. Schatz, the
23 | President of Citizens Against Government Waste, which has been a steadfast critic of the alternate engine and recently released a
24 | detailed report on the subject.
"Neither party
25 | comes out looking good, but Republicans in particular missed a golden opportunity to show that they are really serious about getting government spending under control."
The next
26 | chance to stop the half-billion dollar alternate engine earmark is the Senate, when it takes up the defense authorization bill later this month. But even success there from genuine fiscal
27 | conservatives such as John McCain could be undone when the bill goes to conference -- it's the Washington way.
The final stop would be a presidential veto, which President Obama has
28 | promised, under advice from Defense Secretary Gates.
A half century ago, Republican President Eisenhower warned about the influence of the military-industrial complex.
29 | The former five-star general crusaded against government waste, especially in the military, because he knew that a figure with lesser credibility could be attacked
30 | as being "soft on communism" for proposing responsible cuts from the Pentagon budget during the Cold War.
We are at war today on two fronts, even
31 | as we face down a fiscal crisis and escalating deficits and debt.
We owe it to our troops to see that every dollar allocated to the military is spent where
32 | they need it, not where congressional appropriators want it. And if fiscal conservative protesters cannot marshal their energy to oppose this half-billion dollar
33 | boondoggle, then it is not just Congress' hypocrisy they should be angry at -- it is their own.
The opinions expressed in this
34 | commentary are solely those of John P. Avlon.