white spaces and fixes
MODIFY
tika-core/src/main/java/org/apache/tika/transcribe/Transcriber.java
tika-core/src/main/java/org/apache/tika/transcribe/Transcriber.java
@@ -21,7 +21,6 @@ import org.apache.tika.exception.TikaException;
import java.io.IOException;
-
/**
* Interface for Transcriber services.
* TODO add documentation
@@ -52,15 +51,6 @@ public interface Transcriber {
*/
public String transcribe(String filePath, String sourceLanguage) throws TikaException, IOException;
- /**
- * Gets Transcription result from AWS S3 bucket given bucketName and jobName
- *
- * @param key
- * @return
- */
- public String getTranscriptResult(String key);
-
-
/**
* @return true if this Transcriber is probably able to translate right now.
* @since Tika 2.1

MODIFY
tika-transcribe/src/main/java/org/apache/tika/transcribe/AmazonTranscribe.java
tika-transcribe/src/main/java/org/apache/tika/transcribe/AmazonTranscribe.java
package org.apache.tika.transcribe;
-import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.PutObjectRequest;
@@ -33,7 +32,6 @@ import java.io.IOException;
import java.util.Properties;
import java.util.UUID;
-
public class AmazonTranscribe implements Transcriber {
public static final String PROPERTIES_FILE = "transcribe.amazon.properties";
@@ -43,7 +41,6 @@ public class AmazonTranscribe implements Transcriber {
public static final String DEFAULT_SECRET = "dummy-secret";
public static final String DEFAULT_BUCKET = "dummy-bucket";
public static final String BUCKET_NAME = "transcribe.BUCKET_NAME";
-
private static final Logger LOG = LoggerFactory.getLogger(AmazonTranscribe.class);
private AmazonTranscribeAsync amazonTranscribe;
private AmazonS3 amazonS3;
@@ -51,8 +48,6 @@ public class AmazonTranscribe implements Transcriber {
private boolean isAvailable; // Flag for whether or not translation is available.
private String clientId;
private String clientSecret; // Keys used for the API calls.
-// private HashSet<String> validSourceLanguages = new HashSet<>(Arrays.asList("en-US", "en-GB", "es-US", "fr-CA", "fr-FR", "en-AU",
-// "it-IT", "de-DE", "pt-BR", "ja-JP", "ko-KR")); // Valid inputs to StartStreamTranscription for language of source file (audio)
public AmazonTranscribe() {
Properties config = new Properties();
@@ -72,8 +67,7 @@ public class AmazonTranscribe implements Transcriber {
}
private String getJobKey() {
- UUID uuid = UUID.randomUUID();
- return uuid.toString();
+ return UUID.randomUUID().toString();
}
/**
@@ -81,6 +75,7 @@ public class AmazonTranscribe implements Transcriber {
* {@link PutObjectRequest} object to upload a file to the
* specified bucket and jobName. After constructing the request,
* users may optionally specify object metadata or a canned ACL as well.
+ *
* @param filePath The path of the file to upload to Amazon S3.
*/
private void uploadFileToBucket(String filePath, String jobName) throws TikaException {
@@ -91,12 +86,11 @@ public class AmazonTranscribe implements Transcriber {
} catch (SdkClientException e) {
throw (new TikaException("File Upload to AWS Failed"));
}
-
-
}
/**
* Starts AWS Transcribe Job without language specification
+ *
* @param filePath
* @return key for transcription lookup
* @throws TikaException
@@ -116,8 +110,10 @@ public class AmazonTranscribe implements Transcriber {
amazonTranscribe.startTranscriptionJob(startTranscriptionJobRequest);
return jobName;
}
+
/**
* Starts AWS Transcribe Job with language specification
+ *
* @param filePath
* @param sourceLanguage
* @return key for transcription lookup
@@ -140,7 +136,6 @@ public class AmazonTranscribe implements Transcriber {
return jobName;
}
-
@Override
public boolean isAvailable() {
return this.isAvailable;
@@ -191,7 +186,6 @@ public class AmazonTranscribe implements Transcriber {
* @param fileNameS3
* @return
*/
- @Override
public String getTranscriptResult(String fileNameS3) {
TranscriptionJob transcriptionJob = retrieveObjectWhenJobCompleted(fileNameS3);
if (transcriptionJob != null && !TranscriptionJobStatus.FAILED.equals(transcriptionJob.getTranscriptionJobStatus())) {

white spaces and fixes