/bidirectional_language_translator

Bidirectional Language Translator Mobile Application with Flutter

Primary LanguageDartMIT LicenseMIT

Bidirectional-Language-Translator 🔁 💻

Bidirectional Language Translator Mobile Application with Flutter framework. The application as a flutter framework, is compatible with Android 📱, iOS 📱, Linux 🖥️, Windows 🪟 and Browser(Web) 💻. For the time of now it can only ability to translate the Ge'ez langauge to the Amharic language and vice versa.

Flutter Icon The project's Icon

About the Project 🏗️

  • The Bidirectional Language Translation Project aims to develop a tool that can translate text between Geez and Amharic, two closely related languages spoken in Ethiopia and Eritrea. The project aims to make translation between the two languages more accessible and convenient, particularly for people who may not be fluent in both languages.
  • The project involves the development of a translation engine that uses natural language processing (NLP) techniques to analyze and understand the meaning of text in one language, and then generate equivalent text in the other language. The translation engine will be trained on a large dataset of text in both languages, in order to learn the patterns and rules of each language and improve the accuracy of the translations it generates.
  • The Bidirectional Language Translation Project will benefit a wide range of users, including students, researchers, business professionals, and others who need to translate between Geez and Amharic for various purposes. It will also contribute to the preservation and promotion of these two important languages, by making them more accessible and widely used.

The projects interface

Entire Project Description

  • The folder that named Android, iOS, Linux, MacOS, Web, Windows are about the configuration file path of the their respective platforms.

  • Docs and Outs are the documentation folder of the project.

  • Test folder is the folder of the test code should be prepared.

  • Lib/* is folder that the main functionality of the project is found on.

Snippet Code :code:

  • The below code is the main algorithm that used now.
// Fetch content from the json file
Future<void> translate() async {
  final String response =
      await rootBundle.loadString('assets/files/geez_amharic.json');
  Map lang = await json.decode(response);

  String inputText = textController.text;
  String outputText = '';

  if (dropdownvalue == "Ge'ez to Amharic") {
    if (lang.containsKey(inputText)) {
      outputText = lang[inputText];
    } else {
      outputText = _classifier.classify(inputText);
    }
  } else {
    lang.forEach((key, value) {
      if (value == inputText) {
        outputText = key;
      }
    });
    if (outputText.isEmpty) {
      outputText = _classifier.classify(inputText);
    }
  }

  setState(() {
    outputController.text = outputText;
  });
}
  • The following code is the AI model inference method
String classify(String rawText) {
  // Tokenize input text
  final tokens = rawText.split(' ');

  // Convert tokens to numerical input
  final List<num> input = List.filled(_vocab.length * 2, 0);
  for (int i = 0; i < tokens.length; i++) {
    final index = _vocab.indexOf(tokens[i]);
    if (index >= 0) {
      input[i] = index.toDouble();
      input[_vocab.length + i] = index.toDouble();
    }
  }

  // Run inference
  final output = List.filled(_vocab.length * 2, 0);
  _interpreter?.run(input, output);

  // Convert numerical output to tokens
  final List<String> outputTokens = [];
  for (int i = 0; i < tokens.length; i++) {
    final index = output.indexOf(output[i + _vocab.length]);
    if (index >= 0 && index < _vocab.length) {
      outputTokens.add(_vocab[index]);
    }
  }

  // Join tokens into string and return
  final outputText = outputTokens.join(' ');
  return outputText;
}

Installation ⬇️

  • Install your favorite app from their repective app stores

Usage 🏃‍♂️ 🏃‍♀️

Step 1️⃣

Choose a favorite language to translate a text.

Step 2️⃣

Enter a corresponding text to the first text field

Step 3️⃣

The text will be appear at the text field of the app.

Contributing 🤝

If you are interesting on this project, contact us through the below mail contact to contribute for the project.

  • DANIEL GETANEH <GMail>
  • YEZIBALEM AEMRO <GMail>
  • YEABSIRA AYCHILUHM <GMail>

Authors 👨‍💻 👩‍💻 🇪🇹

LICENSE 🥇

Distributted Under the MIT License. See the LICENCE