I'm trying to use Xuggler like FFMPEG Metadata Wrapper (I just need the list of Chapters of MP4/M4V Video).
So far I have not been able to find a solution.
Can anyone help me?
I was only able to get the following information:
final String filename = "...path...";
IContainer container = IContainer.make();
int result = container.open(filename, IContainer.Type.READ, null);
if (result < 0)
throw new RuntimeException("Failed to open media file");
int numStreams = container.getNumStreams();
long duration = container.getDuration();
long fileSize = container.getFileSize();
long bitRate = container.getBitRate();
System.out.println("Number of streams: " + numStreams);
System.out.println("Duration (ms): " + duration);
System.out.println("File Size (bytes): " + fileSize);
System.out.println("Bit Rate: " + bitRate);
for (int i = 0; i < numStreams; i++) {
IStream stream = container.getStream(i);
IStreamCoder coder = stream.getStreamCoder();
System.out.println("*** Start of Stream Info ***");
System.out.printf("stream %d: ", i);
System.out.printf("type: %s; ", coder.getCodecType());
System.out.printf("codec: %s; ", coder.getCodecID());
System.out.printf("duration: %s; ", stream.getDuration());
System.out.printf("start time: %s; ", container.getStartTime());
System.out.printf("timebase: %d/%d; ", stream.getTimeBase().getNumerator(),
stream.getTimeBase().getDenominator());
System.out.printf("coder tb: %d/%d; ", coder.getTimeBase().getNumerator(),
coder.getTimeBase().getDenominator());
System.out.println();
if (coder.getCodecType() == ICodec.Type.CODEC_TYPE_AUDIO) {
System.out.printf("sample rate: %d; ", coder.getSampleRate());
System.out.printf("channels: %d; ", coder.getChannels());
System.out.printf("format: %s", coder.getSampleFormat());
} else if (coder.getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO) {
System.out.printf("width: %d; ", coder.getWidth());
System.out.printf("height: %d; ", coder.getHeight());
System.out.printf("format: %s; ", coder.getPixelType());
System.out.printf("frame-rate: %5.2f; ", coder.getFrameRate().getDouble());
}
System.out.println();
System.out.println("*** End of Stream Info ***");
UPDATE 07.06.2017
I just tried it with VLCJ, but still I can not get the list of chapters.
File file = new File("ia_ISL_13_r720P.m4v");
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "vlc64/");
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
MediaPlayerFactory mpf = new MediaPlayerFactory();
EmbeddedMediaPlayer emp = mpf.newEmbeddedMediaPlayer();
MediaMeta mediaMeta = mpf.getMediaMeta(file.getAbsolutePath(), true);
MediaMetaData asMediaMetaData = mediaMeta.asMediaMetaData();
System.out.println(asMediaMetaData.getAlbum());
System.out.println(asMediaMetaData.getArtist());
System.out.println(asMediaMetaData.getTitle());
emp.prepareMedia(file.getAbsolutePath());
emp.play();
emp.nextChapter(); // -> GO NEXT CHAPTER - SUCCESS
List<List<String>> allChapterDescriptions = emp.getAllChapterDescriptions();
for (List<String> list : allChapterDescriptions) {
for (String string : list) {
System.out.println(string);
}
}
have you tested Mp4Chapters? Is for .net but is open source and maybe helps.
Am using it in a C# project I guess similar to what you are doing, very similar...
Here am feeding a listbox with mp4 and m4v chapters, with old mp4 and m4v files seams to be working fine, but am having issues with new ones (2014 ->)
using Mp4Chapters;
// more code here...
private void readChapters(string inputFull)
{
using (var str = File.OpenRead(this.inputFull))
{
var extractor = new ChapterExtractor(new StreamWrapper(str));
extractor.Run();
// build the listbox
foreach (var c in extractor.Chapters ?? new ChapterInfo[0])
{
this.lb_chapters.Items.Add(new { chapterTime = c.Time, chapterName = c.Name });
}
}
}
Other options is to parse the video file using ffmpeg and read the result:
ffmpeg -i ia_ISL_13_r720P.m4v -f ffmetadata metadata.txt
I hope this helps, let me know.
(sorry for the english, is not my main language)
Related
I'm trying to grab the frames from a video and put them into a collection of BufferedImage so I can use the images later. I tried to use the code in the second answer for this question, but it wasn't really helpful because the code they provided only grabs the first frame. How would I extract all the frames and put them into a collection?
So, a little bit of Googling (and reading the source code), was I able to hobble together this basic concept.
The "obvious" solution was to loop over the frames in the video and extract them, the "un-obvious" solution was "how"?!
The two methods you need are FFmpegFrameGrabber#getLengthInFrames and FFmpegFrameGrabber#setFrameNumber, from there it's just a simple method of converting the current frame and writing it to a file (which has already been demonstrated from the previous question)
File videoFile = new File("Storm - 106630.mp4");
FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(videoFile.getAbsoluteFile());
frameGrabber.start();
Java2DFrameConverter c = new Java2DFrameConverter();
int frameCount = frameGrabber.getLengthInFrames();
for (int frameNumber = 0; frameNumber < frameCount; frameNumber++) {
System.out.println("Extracting " + String.format("%04d", frameNumber) + " of " + String.format("%04d", frameCount) + " frames");
frameGrabber.setFrameNumber(frameNumber);
Frame f = frameGrabber.grab();
BufferedImage bi = c.convert(f);
ImageIO.write(bi, "png", new File("Frame " + String.format("%04d", frameNumber) + "-" + String.format("%04d", frameCount) + ".png"));
}
frameGrabber.stop();
Now, obviously, you could store the images into some kind of List in memory, just beware, depending on the size and length of the original video, this might run you into memory issues.
You can use OpenCV to extract frames in a video, try the below code. input is the video file path of your computer
VideoCapture cap = new VideoCapture();
String output = "resources/output";
cap.open(input);
int video_length = (int) cap.get(Videoio.CAP_PROP_FRAME_COUNT);
int frames_per_second = (int) cap.get(Videoio.CAP_PROP_FPS);
Mat frame = new Mat();
if (cap.isOpened()) {
System.out.println("Video is opened");
System.out.println("Number of Frames: " + video_length);
System.out.println(frames_per_second + " Frames per Second");
System.out.println("Converting Video to images...");
cap.read(frame);
int frame_number = 0;
while (cap.read(frame)) {
Imgcodecs.imwrite(output + "/" + frame_number + ".jpg", frame);
frame_number++;
}
cap.release();
processingStatus = video_length + " Frames extracted";
System.out.println(processingStatus);
} else {
processingStatus = "Failed";
System.out.println(processingStatus);
}
i want to split pdf to image file by page, but i got Warning: You did not close a PDF Document looping when renderImageWithDPI
Still have warning
UPDATE CODE :
public void splitImage(PDDocument document, File checkFile, File theDirSplit, String fileExtension, File theDir, File watermarkDirectory, int numberOfPages)
throws InvalidPasswordException, IOException {
String fileName = checkFile.getName().replace(".pdf", "");
int dpi = 300;
if (theDirSplit.list().length < numberOfPages)
{
for (int i = 0; i < numberOfPages; ++i)
{
if (i == numberOfPages)
break;
if (theDirSplit.list().length != numberOfPages)
{
File outPutFile = new File(theDirSplit + Constan.simbol + fileName + "_" + (i + 1) + "." + fileExtension);
document = PDDocument.load(checkFile);
PDFRenderer pdfRenderer = new PDFRenderer(document);
BufferedImage bImage = pdfRenderer.renderImageWithDPI(i, dpi, ImageType.RGB);
ImageIO.write(bImage, fileExtension, outPutFile);
}
// splitService.watermark(outPutFile, (i + 1), watermarkDirectory, "pdf");
}
document.close();
//System.out.println("Converted Images are saved at -> " + theDirSplit.getAbsolutePath());
}
System.out.println("Done Partial SPlit");
/*
* int i = 1; while (iterator.hasNext()) { PDDocument pd = iterator.next();
* pd.save(theDirSplit + Constan.simbol + i++ + ".pdf"); }
* System.out.println("Multiple PDF’s created");
*/
}
error looping
total warning same with number of pages...
i already try to close but not work, this process make my server java.lang.OutOfMemoryError: Java heap space
update :
else if ("pdf".equalsIgnoreCase(typeFile)) {
System.out.println(
"target file " + downloadPath + R_OBJECT_ID + Constan.simbol + R_OBJECT_ID + "." + typeFile);
//get jumlah halaman
try(PDDocument document = PDDocument.load(checkFile)){
File theDirSplit = new File(theDir.getAbsolutePath() + Constan.simbol + "splitImage");
createFolder(theDirSplit);
String fileExtension = "jpeg";
File watermarkDirectory = new File(theDir.getAbsolutePath() + Constan.simbol + "watermarkImage");
createFolder(watermarkDirectory);
// split 2 page image
if (theDirSplit.list().length <= document.getNumberOfPages()) {
try {
splitImage(document,checkFile, theDirSplit, fileExtension, theDir, watermarkDirectory, document.getNumberOfPages()/2);
} catch (IOException e) {
System.out.println("ERROR SPLIT PDF " + e.getMessage());
e.printStackTrace();
}
}
res.setTotalPages(document.getNumberOfPages());
document.close();
return new ResponseEntity<>(res, HttpStatus.OK);
}
} else {
res.setTotalPages(1);
return new ResponseEntity<>(res, HttpStatus.OK);
}
this is code to call split method....
This is somewhat lost from the question, but the cause was failing to close the documents generated by splitter.split().
public String generateDataPDF() {
System.out.println("Inside generate PDF");
String filePath = "";
HttpSession sess = ServletActionContext.getRequest().getSession();
try {
sess.setAttribute("msg", "");
if (getCrnListType().equalsIgnoreCase("F")) {
try {
filePath = getModulePath("CRNLIST_BASE_LOCATION") + File.separator + getCrnFileFileName();
System.out.println("File stored path : " + filePath);
target = new File(filePath);
FileUtils.copyFile(crnFile, target);
} catch (Exception e) {
System.out.println("File path Exception " + e);
}
}
System.out.println("Values from jsp are : 1)Mode of Generation : " + getCrnListType() + " 2)Policy Number : " + getCrnNumber() + " 3)Uploaded File Name : " + getCrnFileFileName() + " 4)LogoType : " + getLogoType()
+ " 5)Output Path : " + getOutputPath() + " 6)Type of Generation : " + getOptionId() + " 7)PDF Name : " + getPdfName());
String srtVAL = "";
String arrayVaue[] = new String[]{getCrnListType(), getCrnListType().equalsIgnoreCase("S") ? getCrnNumber() : filePath, getLogoType().equalsIgnoreCase("WL") ? "0" : "1",
getOutputPath(), getGenMode(), getRenType()};
//INS DB Connection
con = getInsjdbcConnection();
ArrayList selectedCRNList = new ArrayList();
String selectedCRNStr = "";
selectedCRNStr = getSelectedVal(selectedCRNStr, arrayVaue[1]);
String[] fileRes = selectedCRNStr.split("\\,");
if (fileRes[0].equalsIgnoreCase("FAIL")) {
System.out.println("fileRes is FAIL beacause of other extension file.");
sess.setAttribute("pr", "Please upload xls or csv file.");
return SUCCESS;
}
System.out.println("List file is : " + selectedCRNStr);
String st[] = srtVAL.split("[*]");
String billDateStr = DateUtil.getStrDateProc(new Date());
Timestamp strtPasrsingTm = new Timestamp(new Date().getTime());
String minAMPM = DateUtil.getTimeDate(new Date());
String str = "";
String batchID = callSequence();
try {
System.out.println("Inside Multiple policy Generation.");
String userName=sess.getAttribute("loginName").toString();
String list = getProcessesdList(userName);
if (list != null) {
System.out.println("list is not null Users previous data is processing.....");
//setTotalPDFgNERATEDmSG("Data is processing please wait.");
sess.setAttribute("pr","Batch Id "+list+" for User " + userName + " is currently running.Please wait till this Process complete.");
return SUCCESS;
}
String[] policyNo = selectedCRNStr.split("\\,");
int l = 0, f = 0,counter=1;
for (int j = 0; j < policyNo.length; j++,counter++) {
String pdfFileName = "";
int uniqueId=counter;
globUniqueId=uniqueId;
insertData(batchID, new Date(), policyNo[j], getOptionId(), userName,uniqueId);
System.out.println("Executing Proc one by one.");
System.out.println("policyNo[j]" + policyNo[j]);
System.out.println("getOptionId()" + getOptionId());
System.out.println("seqValue i.e batchId : " + batchID);
}
str = callProcedure(policyNo[j], getOptionId(), batchID);
String[] procResponse = str.split("\\|");
for (int i = 0; i < procResponse.length; i++) {
System.out.println("Response is : " + procResponse[i]);
}
if (procResponse[0].equals("SUCCESS")) {
Generator gen = new Generator();
if (getPdfName().equalsIgnoreCase("true")) {
System.out.println("Checkbox is click i.e true");
pdfFileName = procResponse[1];
} else {
System.out.println("Checkbox is not click i.e false");
String POLICY_SCH_GEN_PSS = getDetailsForFileName(userName, policyNo[j], batchID);
String[] fileName = POLICY_SCH_GEN_PSS.split("\\|");
if (getLogoType().equals("0") || getLogoType().equals("2")) {
System.out.println("If logo is O or 1");
pdfFileName = fileName[1];
} else if (getLogoType().equals("1")) {
System.out.println("If logo is 2");
pdfFileName = fileName[0];
}
}
b1 = gen.genStmt(procResponse[1], procResponse[2], "2", getLogoType(), "0", pdfFileName,"1",userName,batchID);
l++;
updateData(uniqueId,batchID, "Y");
} else {
f++;
updateData(uniqueId,batchID, "F");
}
}
sess.setAttribute("pr","Total "+l+" "+getGenericModulePath("PDF_RES1") + " " + " " + getGenericModulePath("PDF_RES2") + " " + f);
}catch (Exception e) {
updateData(globUniqueId,batchID, "F");
System.out.println("Exception in procedure call");
setTotalPDFgNERATEDmSG("Fail");
e.printStackTrace();
sess.setAttribute("pr", "Server Error.");
return SUCCESS;
}
}catch (Exception ex) {
ex.printStackTrace();
sess.setAttribute("pr", "Server Error.");
return SUCCESS;
}
System.out.println("Above second return");
return SUCCESS;
}
GenerateDataPDf method generates PDF based on the parameters i.e ProductType(GenMode),CrnList(uploaded in excel file...)Code works fine when only single user generates PDF. But If two different User(User and roles are assigned in application) start the process same time request paraeters are overridden then! Suppose first user request pdf for 50 customers for product 1. User1's process is still running and second user request for product2. Now User1's pdf are generated but for product2.....! Here batchId is unique for every single request.One table is maintained where batch_id,all pdf,generation flags are mainained there. How do I solve this?
As per your comment, this is what I would do, It's probably not the best way to do !
Firstly : Create a function to collet all your data at the beginning. You should not modify/update/create anything when you are generating a PDF. IE : array/list collectPDFData() wich should retourn an array/list.
Secondly : Use a synchronized methods like synchronized boolean generatePDF(array/list)
"Synchronized" methods use monitor lock or intrinsic lock in order to manage synchronization so when using synchronized, each method share the same monitor of the corresponding object.
NB : If you use Synchronize, it's probably useless to collect all your data in a separate way, but I think it's a good practice to make small function dedicated to a specific task.
Thus, your code should be refactored a little bit.
My application tracks the distance and shows the result in km on the screen. I save the geopoints in an ArrayList. I’d like to export the geopoints as a GPX track file to my sdcard.
I tried https://sourceforge.net/projects/gpxparser/. But after the command GPXParser p = new GPXParser(); my app crashes. (I couldn’t find out how to “instantiate the GPXParser class”, maybe that’s why it didn’t work).
Importing GPX files works flawless with this approach http://android-coding.blogspot.de/2013/01/get-latitude-and-longitude-from-gpx-file.html
Could anyone point me in a direction or give me a hint. I’ve search a lot, but couldn’t find anything I could get to work.
Update!
I've found a solution. Maybe not perfect, but it works.
To save my track, I use the following from my Map-Activity.
Maybe some has a better solution :-).
public void saveRoute(String filename) {
Toast.makeText(this, mTrace.size() + "", Toast.LENGTH_SHORT).show();
String fileName = filename;
// routeFile = new File(getFilesDir(), FILENAME);
String root = Environment.getExternalStorageDirectory().toString();
File myDir = new File(root + "/kml");
myDir.mkdirs();
File file = new File(myDir, fileName + ".gpx");
savegpx gpxFile = new savegpx();
try {
file.createNewFile();
gpxFile.writePath(file, fileName, mTrace);
// Log.i(TAG, "Route Saved " + file.getName());
} catch (Exception e) {
Log.e("WritingFile", "Not completed writing" + file.getName());
}
}
Separate class
public class savegpx {
private static final String TAG = savegpx.class.getName();
public savegpx() {
}
/**
* Writes locations to gpx file format
*
* #param file file for the gpx
* #param n name for the file
* #param points List of locations to be written to gpx format
*/
public static void writePath(File file, String n, ArrayList<GeoPoint> points) {
final Context applicationContext= MainActivity.getContextOfApplication();
String header = "<gpx creator=\"Off-Road Tracker\" version=\"1.1\" xmlns=\"http://www.topografix.com/GPX/1/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">\n";
String metadata = " <metadata>\n" + " <time>1900-01-01T00:00:00Z</time>" + "\n </metadata>";
String name = " <trk>\n <name>" + n + "</name>\n <trkseg>\n";
String segments = "";
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
List<String> stockList = new ArrayList<String>();
for (int i = 0; i < points.size(); i++) {
stockList.add(" <trkpt lat=\"" + (points.get(i)).getLatitude() + "\" lon=\"" + (points.get(i)).getLongitude() + "\">\n <ele>" +(points.get(i).getAltitude()) + "</ele>\n <time>" + df.format(new Date()) + "Z</time>\n </trkpt>\n");
}
segments +=stockList;
segments = segments.replace(",","");
segments = segments.replace("[","");
segments = segments.replace("]","");
Toast.makeText(applicationContext, segments, Toast.LENGTH_LONG).show();
String footer = " </trkseg>\n </trk>\n</gpx>";
try {
FileWriter writer = new FileWriter(file);
writer.append(header);
writer.append(metadata);
writer.append(name);
writer.append(segments);
writer.append(footer);
writer.flush();
writer.close();
Log.i(TAG, "Saved " + points.size() + " points.");
} catch (IOException e) {
//Toast.makeText(mapsActivity.getApplicationContext(),"File not found",Toast.LENGTH_SHORT);
Log.e(TAG, "Error Writting Path", e);
}
}
}
I am trying to figure out the way to rewrite sentences by "resolving" (replacing words with) their coreferences using Stanford Corenlp's Coreference module.
The idea is to rewrite a sentence like the following :
John drove to Judy’s house. He made her dinner.
into
John drove to Judy’s house. John made Judy dinner.
Here's the code I've been fooling around with :
private void doTest(String text){
Annotation doc = new Annotation(text);
pipeline.annotate(doc);
Map<Integer, CorefChain> corefs = doc.get(CorefChainAnnotation.class);
List<CoreMap> sentences = doc.get(CoreAnnotations.SentencesAnnotation.class);
List<String> resolved = new ArrayList<String>();
for (CoreMap sentence : sentences) {
List<CoreLabel> tokens = sentence.get(CoreAnnotations.TokensAnnotation.class);
for (CoreLabel token : tokens) {
Integer corefClustId= token.get(CorefCoreAnnotations.CorefClusterIdAnnotation.class);
System.out.println(token.word() + " --> corefClusterID = " + corefClustId);
CorefChain chain = corefs.get(corefClustId);
System.out.println("matched chain = " + chain);
if(chain==null){
resolved.add(token.word());
}else{
int sentINdx = chain.getRepresentativeMention().sentNum -1;
CoreMap corefSentence = sentences.get(sentINdx);
List<CoreLabel> corefSentenceTokens = corefSentence.get(TokensAnnotation.class);
String newwords = "";
CorefMention reprMent = chain.getRepresentativeMention();
System.out.println(reprMent);
for(int i = reprMent.startIndex; i<reprMent.endIndex; i++){
CoreLabel matchedLabel = corefSentenceTokens.get(i-1); //resolved.add(tokens.get(i).word());
resolved.add(matchedLabel.word());
newwords+=matchedLabel.word()+" ";
}
System.out.println("converting " + token.word() + " to " + newwords);
}
System.out.println();
System.out.println();
System.out.println("-----------------------------------------------------------------");
}
}
String resolvedStr ="";
System.out.println();
for (String str : resolved) {
resolvedStr+=str+" ";
}
System.out.println(resolvedStr);
}
The best output I was able to achieve for now is
John drove to Judy 's 's Judy 's house . John made Judy 's her dinner .
which is not very brilliant ...
I'm pretty sure there is a MUCH easier way to do what I am trying to achieve.
Ideally, I would like to reorganize the sentence as a list of CoreLabels, so that I could keep the other data they have attached to them.
Any help appreciated.
The challenge is you need to make sure that the token isn't part of its representative mention. For example, the token "Judy" has "Judy 's" as its representative mention, so if you replace it in the phrase "Judy 's", you'll end up with the double "'s".
You can check if the token is part of its representative mention by comparing their indices. You should only replace the token if its index is either smaller than the startIndex of the representative mention, or larger than the endIndex of the representative mention. Otherwise you just keep the token.
The relevant part of your code will now look like this:
if (token.index() < reprMent.startIndex || token.index() > reprMent.endIndex) {
for (int i = reprMent.startIndex; i < reprMent.endIndex; i++) {
CoreLabel matchedLabel = corefSentenceTokens.get(i - 1);
resolved.add(matchedLabel.word());
newwords += matchedLabel.word() + " ";
}
}
else {
resolved.add(token.word());
}
In addition, and to speed up the process, you can also replace your first if-condition by:
if (chain==null || chain.getMentionsInTextualOrder().size() == 1)
After all, if the length of the co-reference chain is just 1, there is no use looking for a representative mention.
private void doTest(String text){
Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
Annotation doc = new Annotation(text);
pipeline.annotate(doc);
Map<Integer, CorefChain> corefs = doc.get(CorefChainAnnotation.class);
List<CoreMap> sentences = doc.get(CoreAnnotations.SentencesAnnotation.class);
List<String> resolved = new ArrayList<String>();
for (CoreMap sentence : sentences) {
List<CoreLabel> tokens = sentence.get(CoreAnnotations.TokensAnnotation.class);
for (CoreLabel token : tokens) {
Integer corefClustId= token.get(CorefCoreAnnotations.CorefClusterIdAnnotation.class);
System.out.println(token.word() + " --> corefClusterID = " + corefClustId);
CorefChain chain = corefs.get(corefClustId);
System.out.println("matched chain = " + chain);
if(chain==null){
resolved.add(token.word());
System.out.println("Adding the same word "+token.word());
}else{
int sentINdx = chain.getRepresentativeMention().sentNum -1;
System.out.println("sentINdx :"+sentINdx);
CoreMap corefSentence = sentences.get(sentINdx);
List<CoreLabel> corefSentenceTokens = corefSentence.get(TokensAnnotation.class);
String newwords = "";
CorefMention reprMent = chain.getRepresentativeMention();
System.out.println("reprMent :"+reprMent);
System.out.println("Token index "+token.index());
System.out.println("Start index "+reprMent.startIndex);
System.out.println("End Index "+reprMent.endIndex);
if (token.index() <= reprMent.startIndex || token.index() >= reprMent.endIndex) {
for (int i = reprMent.startIndex; i < reprMent.endIndex; i++) {
CoreLabel matchedLabel = corefSentenceTokens.get(i - 1);
resolved.add(matchedLabel.word().replace("'s", ""));
System.out.println("matchedLabel : "+matchedLabel.word());
newwords += matchedLabel.word() + " ";
}
}
else {
resolved.add(token.word());
System.out.println("token.word() : "+token.word());
}
System.out.println("converting " + token.word() + " to " + newwords);
}
System.out.println();
System.out.println();
System.out.println("-----------------------------------------------------------------");
}
}
String resolvedStr ="";
System.out.println();
for (String str : resolved) {
resolvedStr+=str+" ";
}
System.out.println(resolvedStr);
}
Gave perfect answer.
John drove to Judy’s house. He made her dinner. ----->
John drove to Judy 's house . John made Judy dinner .
Tom is a smart boy. He know a lot of thing. ----->
Tom is a smart Tom . Tom know a lot of thing .