Coder Social home page Coder Social logo

brenoepics / at4j Goto Github PK

View Code? Open in Web Editor NEW
18.0 1.0 3.0 1.23 MB

Microsoft Azure Translator for Java

Home Page: https://brenoepics.github.io/at4j/

License: Apache License 2.0

Java 100.00%
auto-translation microsoft-azure microsoft-translator translation-tool translator azure collaborate ghdesktop github github-copilot

at4j's Introduction

Azure Translator for Java (AT4J)

Maven Central Static Badge Static Badge Coverage Quality Gate Status

An unofficial Java library for translating text using Azure AI Cognitive Services.

✨ Features

  • Text Translation: Translate text from one language (or detect) to another or to a list of languages.
  • Language Detection: Detect the language of a given text.
  • Profanity Handling: Options for handling profanity in translations.
  • Text Type Support: We support both plain text and HTML text translation.
  • And more.

πŸ“ Documentation

πŸŽ‰ Basic Usage

Note

Example repository Azure-Translator-Example

The following example translates a simple Hello World to Portuguese, Spanish and French.

public class ExampleTranslator {
  public static void main(String[] args) {
    // Insert your Azure key and region here
    String azureKey = "<Your Azure Subscription Key>";
    String azureRegion = "<Your Azure Subscription Region>";
    AzureApi api = new AzureApiBuilder().setKey(azureKey).region(azureRegion).build();

    // Set up translation parameters
    List < String > targetLanguages = List.of("pt", "es", "fr");
    TranslateParams params =
            new TranslateParams("Hello World!", targetLanguages).setSourceLanguage("en");

    // Translate the text
    Optional < TranslationResponse > translationResult = api.translate(params).join();

    // Print the translations
    translationResult.ifPresent(
            response ->
                    response.getFirstResult().getTranslations().forEach(ExampleTranslator::logLanguage));
  }

  public static void logLanguage(Translation translation) {
    System.out.println(translation.getLanguageCode() + ": " + translation.getText());
  }
}
Expected Output
pt: OlΓ‘, Mundo!
es: Β‘Hola mundo!
fr: Salut tout le monde!

πŸ“¦ Download / Installation

The recommended way to get AT4J is to use a build manager, like Gradle or Maven.

Gradle
implementation group: 'io.github.brenoepics', name: 'at4j', version: '1.2.0'
Maven
<dependency>
    <groupId>io.github.brenoepics</groupId>
    <artifactId>at4j</artifactId>
    <version>1.2.0</version>
</dependency>
Sbt
libraryDependencies += "io.github.brenoepics" % "at4j" % "1.2.0"

Frequently Asked Questions (FAQ)

Q: How do I access Azure Translator Keys for my project?

A: You can access your Azure Translator Keys through your Azure portal. Remember to keep your keys secure and refrain from sharing them publicly. If you suspect a key has been compromised, it's crucial to regenerate it promptly. For detailed instructions on generating your own keys, refer to this guide. Additionally, you can explore the Azure Free Tier for more information.

🀝 Thank You!

  • Microsoft Azure: Supporting our project with a generous grant of $10,000+ in Azure credits, enabling us to use virtual machines, document translation and other essential cloud resources for our development needs.
  • We extend our sincere thanks to all contributors for their invaluable contributions.

πŸ§‘β€πŸ’» Contributing

Contributions of any kind are welcome. You can start contributing to this library by creating issues, submitting pull requests or giving a star to the project.

πŸ“ƒ License

AT4J is distributed under the Apache license version 2.0.

at4j's People

Contributors

actions-user avatar brenoepics avatar deepsource-autofix[bot] avatar dependabot[bot] avatar vidigal-code avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

at4j's Issues

Enhance Documentation

Our current documentation does not provide enough information on how to use the library. We need to enhance our documentation to make it easier for users to understand how to use our library effectively.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.