Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Apertium-as-Service idea - Helplessly lost #34

Open
SomeTroglodyte opened this issue Mar 26, 2023 · 2 comments
Open

Simple Apertium-as-Service idea - Helplessly lost #34

SomeTroglodyte opened this issue Mar 26, 2023 · 2 comments
Labels
question Further information is requested

Comments

@SomeTroglodyte
Copy link

This works (kotlin):

    fun String.apertiumTranslated(): String {
        val charset = Charset.forName("UTF-8")
        val process = Runtime.getRuntime().exec("apertium en-eo")
        val stdin = process.outputStream
        stdin.write(this.toByteArray(charset))
        stdin.flush()
        stdin.close()
        process.waitFor()
        return process.inputStream.readBytes().toString(charset)
    }

Question: Replace function body so the translation runs entirely in-process.

Sounds trivial. I spent 30 minutes getting a large FOSS game to run just fine in a natively unsupported language - translated on-the-fly through Apertium, then hours researching that question. I even cloned caffeine in the hopes reading source might be clearer. I give up. The only path that's documented and contains no "legacy" or "sourceforge" dead-ends wouldn't satisfy the "in-process" wish.

I'm not looking for a ready-cooked solution. I just want to raise awareness that your jungle can be extremely confusing for outsiders.

@TinoDidriksen
Copy link
Member

TinoDidriksen commented Mar 26, 2023

Kotlin, so Java. We do not have up-to-date Java tools, and we have no plans on continuing the Java codebase.

If you were doing this in native code or Python, then you could get it all in-process. Still not trivially, but certainly doable. I actually recommend instrumenting a sub-process, as that insulates the host from pipe crashes.

Also, we have Apertium-as-a-Service: https://github.com/apertium/apertium-apy

@TinoDidriksen TinoDidriksen added the question Further information is requested label Mar 26, 2023
@SomeTroglodyte
Copy link
Author

Thanks. It is as I guessed. Goal reached - awareness that someone could come from this direction. Keep it up 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants