2014-02-25 4 views
0

영어에서 영어 및 영어에 대한 용어를 영어로 변환 할 수있는 Android 앱을 개발하고 싶습니다.이 작업을 수행 할 수있는 API가 있습니까?이를 수행하는 가장 좋은 방법은 무엇입니까?영어 대명사 및 영어 대 영어 전환

+0

우리가 lingo.or의 지불 유료 서비스로 변환 할 수 – nikis

+0

@nikis 예를 들어 구글은 API를 번역? –

답변

0

이 목적을 위해

private final String requestURLTranslation = "https://www.googleapis.com/language/translate/v2?key="; 
    private final String requestKey = "INSERT-YOUR-KEY"; 
    private final String requestSrc = "&source="; 
    private final String requestDst = "&target="; 
    private final String requestTxt = "&q="; 


    public String requestTranslationForGoogle(String plaintext, String source, String destination) { 

     String request = requestURLTranslation + requestKey + requestSrc + source + requestDst + destination + requestTxt;  
     try { 
      request += URLEncoder.encode(plaintext, "UTF-8"); 
      URL url = new URL(request); 
      URLConnection connection = url.openConnection(); 
      connection.connect(); 
      InputStreamReader inputStreamReader = new InputStreamReader(connection.getInputStream(), "UTF-8"); 
      BufferedReader in = new BufferedReader(inputStreamReader, 512); 
      StringBuffer sb = new StringBuffer(); 
      String line; 
      while ((line = in.readLine()) != null) { 
       sb.append(line); 
      } 
      in.close(); 
      return sb.toString(); 
     } 
     catch (Exception e) { 
      e.printStackTrace(); 
     } 
     return null; 
    } 

주 구글 API를 사용할 수 있습니다 : 코드는 더 분석해야합니다 JSON 데이터를 반환합니다

1) https://github.com/Rookery/google-api-translate-android

를 방문하시기 바랍니다

이쪽

2) http://api.yandex.com/translate/

3) http://mymemory.translated.net/

+0

@ Jitesh 이러한 API를 통해 용어로 변환 할 수 있습니까? –

+0

@ 스와 티 나는 당신이 구글 번역으로 할 수 있다고 생각한다 !! 크로스 체크하시기 바랍니다 !! –

+0

링크 전용 답변은 권장되지 않습니다. 앞으로 링크가 죽어 버리면 대답은 가치가 없으므로 게시물에 관련 콘텐츠를 게시해야합니다. 당신은 코멘트로 링크를 게시할만한 충분한 평판이 있습니다 – Raghunandan