Skip to content

Commit b25ca7f

Browse files
Merge branch 'dev' of github.com:watson-developer-cloud/java-sdk into dev
2 parents 93e627b + 515be76 commit b25ca7f

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ If you want to contribute to the repository, here's a quick guide:
1717
* Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
1818
* Check for unnecessary whitespace with git diff --check before committing.
1919
3. Make the test pass
20-
4. Commit your changes
20+
4. Commit your changes
21+
Commit messages should start with the service name and end with the issue number if exists
22+
`[concept-insights] Added functionality to list the graphs #135`
2123
5. Push to your fork and submit a pull request to the **dev** branch
2224

2325
# Developer's Certificate of Origin 1.1
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
13+
*/
14+
package com.ibm.watson.developer_cloud.document_conversion.v1;
15+
16+
import com.google.gson.JsonObject;
17+
import com.google.gson.JsonParser;
18+
import com.ibm.watson.developer_cloud.document_conversion.v1.model.Answers;
19+
import com.ibm.watson.developer_cloud.http.HttpMediaType;
20+
21+
import java.io.File;
22+
23+
public class DocumentConversionCustomConfigExample {
24+
public static void main(String[] args) {
25+
final String versionDate = "2015-12-14";
26+
DocumentConversion service = new DocumentConversion(versionDate);
27+
service.setUsernameAndPassword("<username>", "<password>");
28+
29+
final File html = new File("src/test/resources/document_conversion/html-with-extra-content-input.htm");
30+
31+
// Run a conversion with no configuration specified. The Document Conversion service will use
32+
// its default configuration when no configuration is specified. For this example, the
33+
// Document Conversion service will section a HTML document by h1, h2, h3, h4, h5, and h6 tags.
34+
// Those sections will be returned as Answers
35+
System.out.println("Convert html document to Answer Units using default configuration");
36+
final Answers htmlToAnswersWithDefaultConfig =
37+
service.convertDocumentToAnswer(html, HttpMediaType.TEXT_HTML);
38+
System.out.println(htmlToAnswersWithDefaultConfig);
39+
40+
System.out.println("==================================================");
41+
42+
// Run a conversion with a custom configuration. The next example shows how to convert this same
43+
// document with a custom configuration. Instead of sectioning by the default settings (h1, h2,
44+
// h3, h4, h5, and h6), the following example shows how to section a HTML document by only the
45+
// h1 tag. This will result in Answers that are sectioned by h1 tags.
46+
String configAsString = "{\n" +
47+
" \"answer_units\": {\n" +
48+
" \"selector_tags\": [\"h1\"]\n" +
49+
" }\n" +
50+
"}";
51+
JsonParser jsonParser = new JsonParser();
52+
JsonObject customConfig = jsonParser.parse(configAsString).getAsJsonObject();
53+
54+
System.out.println("Convert html document to Answer Units using custom configuration");
55+
final Answers htmlToAnswersWithCustomConfig =
56+
service.convertDocumentToAnswer(html, HttpMediaType.TEXT_HTML, customConfig);
57+
System.out.println(htmlToAnswersWithCustomConfig);
58+
}
59+
}

src/main/java/com/ibm/watson/developer_cloud/document_conversion/v1/DocumentConversion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class DocumentConversion extends WatsonService {
6464

6565
/** The default URL for the service. */
6666
private static final String URL =
67-
"https://gateway.watsonplatform.net/document-conversion-experimental/api";
67+
"https://gateway.watsonplatform.net/document-conversion/api";
6868

6969
private static final JsonObject EMPTY_CONFIG = new JsonParser().parse("{}").getAsJsonObject();
7070

0 commit comments

Comments
 (0)