fork download
  1. //RECOGNITION.JAVA
  2.  
  3. import java.lang.*;
  4. import java.io.*;
  5. import.java.util.Scanner;
  6.  
  7. public class RECOGNITION
  8. {
  9. //find euclidean distance btw 2 feature vectors
  10. public static void main(string[] args)
  11. {
  12. Scanner input=new Scanner(System.in);
  13. int featurevector1[]=new int[11];
  14. int featurevector2[]=new int[11];
  15. string arr[]={"roman","hebrew","devnagiri","cyrillic","hans","arabic"};
  16. int i;
  17. //input the values
  18. system.out.println("input the feature vectors of the input script\n");
  19.  
  20. for(i=0;i<11;i++)
  21. {
  22. featurevector1[i]=input.nextInt();
  23. }
  24. system.out.println("input the feature vectors of the sample script\n");
  25. int j;
  26. for(j=0;j<11;j++)
  27. {
  28. featurevector2[j]=input.nextInt();
  29. }
  30. //comparison
  31. int k;
  32. for(k=0;k<6;k++)
  33. {
  34. double tsum=0.0;
  35. for(int t=0;t<11;t++)
  36. {
  37. double tval=featurevector1[t]-featurevector2[t];
  38. tsum=tsum+(tval*tval);
  39. }
  40. double tans=Math.sqrt(tsum);
  41. if(tans<1.0)
  42. {
  43. system.out.println("the script is recognised to be" +arr[t]+"\n");
  44. break;
  45. }
  46. }
  47. }
  48. }
  49. }
Runtime error #stdin #stdout 0.02s 4980KB
stdin
Standard input is empty
stdout
Standard output is empty