package com.marvinelsen.tatoeba.internal

import com.marvinelsen.tatoeba.api.TatoebaParser
import com.marvinelsen.tatoeba.api.TatoebaSentence
import java.io.InputStream

internal class SimpleTatoebaParser : TatoebaParser {
    override fun parse(inputStream: InputStream) = inputStream
        .bufferedReader()
        .lineSequence()
        .map { it.toToTatoebaSentence() }
}

private fun String.toToTatoebaSentence() = TatoebaSentence(simplified = this.split('\t')[2])
