%% resynthesis.pl %% Find resynthesis, and B of sentence :- use_module(library(date)). :- include('meditationnoreplace'). :- include('texttobr'). resynthesis1 :- get_time(TS),stamp_date_time(TS,date(Year,Month, Day,Hour1,Minute1,_Seconda,_A,_TZ,_False),local), concat_list("resynth_b", [Year,Month,Day,Hour1,Minute1,".txt"],File1), string_concat("./",File1,File2), protocol(File1), time(resynthesis2), noprotocol, texttobr2(u,File2,u,u),texttobr(u,File2,u,u). resynthesis2 :- writeln("This algorithm will help find the resynthesis and B of a sentence."), writeln(""), writeln("Please enter a description of the algorithm."), writeln("For example: Translate the original into the translation, and then back into the back-translation. Check that the original has the same meaning as the back-translation."), read_string(user_input, "\n", "\r", _End0, Description), writeln(""), writeln("Enter the elements of the resynthesised sentence."), writeln("For example: The speed of back-translation is greater than translation."), writeln("The sentence is in the form \"The W (speed/accuracy/intuitivity/...) of X is Y (equal to/greater than/less than) Z.\""), writeln(""), writeln("What is X (the first idea)?"), read_string(user_input, "\n", "\r", _End1, Idea1), writeln(""), writeln("What is Z (the second idea)?"), read_string(user_input, "\n", "\r", _End2, Idea2), writeln(""), writeln("What is W (the property)?"), read_string(user_input, "\n", "\r", _End3, Property1), writeln(""), writeln("What is Y (the relation)?"), read_string(user_input, "\n", "\r", _End4, Relation1), writeln(""), writeln("Enter the elements of the B sentence (corrections and improvements to the resynthesis sentence)"), writeln("For example: The accuracy of back-translation is less than translation."), write("The sentence is in the form \"The W (speed/accuracy/intuitivity/...) of "), write(Idea1), write(" is Y (equal to/greater than/less than) "), write(Idea2), writeln(".\""), writeln(""), writeln("What is W (the property)?"), read_string(user_input, "\n", "\r", _End5, Property2), writeln("What is Y (the relation)?"), read_string(user_input, "\n", "\r", _End6, Relation2), writeln(""), solve_b1(Idea1,Idea2,Property2,Relation2). solve_b1(Idea1,Idea2,Property2,Relation2) :- solve_b2(Idea1,Idea2,Property2,Relation2,Solution1,Solution2), writeln("Will this solve the problem, or is/are there another problem/other problems? (Yes/No)"), ((read_string(user_input, "\n", "\r", _End, "Yes"), writeln(""))-> sentence_b(Idea1,Idea2);solve_b3(Idea1,Idea2,Property2,Relation2,Solution2)). concat_list(A,[],A) :-!. concat_list(A,List,B) :- List=[Item|Items], concat_list2(A,[Item],C), concat_list(C,Items,B). concat_list2(A,List,C) :- ((List=[[Item]]->true;List=[Item])-> string_concat(A,Item,C); fail),!. concat_list2(A,Item,C) :- concat_list(A,Item,C),!. solve_b2(Idea1,Idea2,Property2,Relation2,Solution1,Solution2) :- concat_list("Why is the ",[Property2," of ",Idea1," ",Relation2," ",Idea2,"?"],Solution1), writeln(Solution1), writeln("For example, the problem is that the translation might have words with the wrong meaning."), read_string(user_input, "\n", "\r", _End1, Problem), writeln(""), writeln("What is the solution to this?"), writeln("For example: Check each word has the correct meaning."), read_string(user_input, "\n", "\r", _End2, Solution2), writeln(""). solve_b3(Idea1,Idea2,Property2,Relation2,Solution1) :- concat_list("Why is the following true? ",[Solution1],Sentence), writeln(Sentence), writeln("For example: If a word has the incorrect meaning, its translation is unable to be inserted in the back-translation."), read_string(user_input, "\n", "\r", _End1, Problem), writeln(""), writeln("What is the solution to this?"), writeln("For example: Change the original to have a simpler grammar."), read_string(user_input, "\n", "\r", _End2, Solution2), writeln(""), writeln("Will this solve the problem, or is/are there another problem/other problems? (Yes/No)"), (read_string(user_input, "\n", "\r", _End, "Yes")-> sentence_b(Idea1,Idea2);solve_b3(Idea1,Idea2,Property2,Relation2,Solution2)). sentence_b(Idea1,Idea2) :- writeln("Enter the elements of the solved B sentence."), writeln("For example: The accuracy of back-translation is equal to translation."), write("The sentence is in the form \"The W (speed/accuracy/intuitivity/...) of "), write(Idea1), write(" is Y (equal to/greater than/less than) "), write(Idea2), writeln(".\""), writeln(""), writeln("What is W (the property)?"), read_string(user_input, "\n", "\r", _End1, Property2), writeln(""), writeln("What is Y (the relation)?"), read_string(user_input, "\n", "\r", _End2, Relation2), writeln(""), writeln("Thank you.").