ReversoAPI
1.0.0
.NET용 Reverso 컨텍스트 API
var service = new ReversoService ( ) ;
TranslatedResponse translatedWord = await service . TranslateWord ( new TranslateWordRequest ( from : Language . En , to : Language . Ru )
{
Word = "Influence" ,
} ) ;
TranslatedResponse translatedSegment = await service . TranslateSegment ( new TranslateSegmentRequest ( Language . En , Language . Ru )
{
Source = "Working directory"
} ) ;
TranslateTextResponse translatedText = await service . TranslateSentence ( new TranslateTextRequest ( Language . En , Language . Ru )
{
Source = "We’re happy because we laugh"
} ) ;
문맥 유무에 관계없이 단일 단어를 번역합니다.
매개변수 :
var service = new ReversoService ( ) ;
TranslatedResponse result = await service . TranslateWord ( new TranslateWordRequest ( from : Language . En , to : Language . Ru )
{
Word = "Influence" ,
} ) ;
foreach ( var resultSource in result . Sources )
{
// Gets all variants of translation
foreach ( var translations in resultSource . Translations )
{
Console . WriteLine ( $ "Translated word: { translations . Translation } " ) ;
Console . WriteLine ( "Examples:" ) ;
// Gets all examples for this word translation
foreach ( var translationsContext in translations . Contexts )
{
Console . WriteLine ( $ "Original example: { translationsContext . Source } " ) ;
Console . WriteLine ( $ "Translated example: { translationsContext . Target } " ) ;
}
}
}
한 문장을 번역합니다
매개변수:
TranslateTextResponse translatedText = await service . TranslateSentence ( new TranslateTextRequest ( Language . En , Language . Ru )
{
Source = "We’re happy because we laugh"
} ) ;
Console . WriteLine ( translatedText . Translation ) ;
문장의 간단한 부분을 번역합니다.
매개변수:
var service = new ReversoService ( ) ;
TranslatedResponse result = await service . TranslateSegment ( new TranslateSegmentRequest ( from : Language . En , to : Language . Ru )
{
Source = "Working directory" ,
} )
foreach ( var resultSource in result . Sources )
{
// Gets all variants of translation
foreach ( var translations in resultSource . Translations )
{
Console . WriteLine ( $ "Translated word: { translations . Translation } " ) ;
Console . WriteLine ( "Examples:" ) ;
// Gets all examples for this word translation
foreach ( var translationsContext in translations . Contexts )
{
Console . WriteLine ( $ "Original example: { translationsContext . Source } " ) ;
Console . WriteLine ( $ "Translated example: { translationsContext . Target } " ) ;
}
}
}