<commit_before>/*
 * GoogleTranslation
 *
 * Created by Yii.Guxing on 2018/01/06
 */

@file:Suppress("MemberVisibilityCanBePrivate")

package cn.yiiguxing.plugin.translate.trans

import com.google.gson.annotations.SerializedName


data class GoogleTranslation(
        var original: String? = null,
        val src: Lang,
        var target: Lang? = null,
        val sentences: List<GSentence>,
        val dict: List<GDict>?,
        @SerializedName("ld_result") val ldResult: LDResult
) : TranslationAdapter {

    override fun toTranslation(): Translation {
        check(original != null) { "Can not convert to Translation: original=null" }
        check(target != null) { "Can not convert to Translation: target=null" }

        val translit: TranslitSentence? = sentences.find { it is TranslitSentence } as? TranslitSentence
        val trans = sentences.mapNotNull { (it as? TransSentence)?.trans }.joinToString()

        val dictionaries = dict?.map {<commit_msg>Fix google translation.<commit_after>/*
 * GoogleTranslation
 *
 * Created by Yii.Guxing on 2018/01/06
 */

@file:Suppress("MemberVisibilityCanBePrivate")

package cn.yiiguxing.plugin.translate.trans

import com.google.gson.annotations.SerializedName


data class GoogleTranslation(
        var original: String? = null,
        val src: Lang,
        var target: Lang? = null,
        val sentences: List<GSentence>,
        val dict: List<GDict>?,
        @SerializedName("ld_result") val ldResult: LDResult
) : TranslationAdapter {

    override fun toTranslation(): Translation {
        check(original != null) { "Can not convert to Translation: original=null" }
        check(target != null) { "Can not convert to Translation: target=null" }

        val translit: TranslitSentence? = sentences.find { it is TranslitSentence } as? TranslitSentence
        val trans = sentences.mapNotNull { (it as? TransSentence)?.trans }.joinToString("")

        val dictionaries = dict?.map {
{'fraction_non_alphanumeric': 0.10674157303370786, 'fraction_numerical': 0.008171603677221655, 'mean_word_length': 3.4121621621621623, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3958271', 'n_tokens_mistral': 582, 'n_tokens_neox': 547, 'n_words': 154}