Giter Club home page Giter Club logo

oc_ai_01's Introduction

Azure Translator Interface

This project aims to test how well Azure Translator service performs when it comes to detect languages.

To do so, we will select text of the 5 most common languages from the Wikipedia Language Identification Database, and compare the returned language label with the already known language label and ouput some scores.

The selected languages are: Mandarin Chinese (zho), Spanish (spa), English (eng), Arabic (ara), Hindi (hin).

Installation

In order to use this project locally, you need to follow the steps below:

First,

let's duplicate the project github repository

>>> git clone https://github.com/Valkea/OC_AI_01.git
>>> cd OC_AI_01

Secondly,

let's create a virtual environment and install the required Python libraries

(Linux or Mac)

>>> python3 -m venv venv
>>> source venv/bin/activate
>>> pip install -r requirements.txt

(Windows):

>>> py -m venv venv
>>> .\venv\Scripts\activate
>>> py -m pip install -r requirements.txt

Secret Keys and Endpoint

In order to use the Azure API, one needs to get its own crendentials (I can't share mine indeed).

On Azure's portal, create a new Translator ressource, then go to the overview panel for this ressource. There you will be able to manage the Keys and the Endpoint of the ressource.

Create a secrets.txt file in the project folder, and copy KEY1 (or KEY2) on the first line and the END_POINT on the second line (the values only).

Without this file and valid credentials, the Python script won't be able to proceed.

Notebook

The provided notebook offers to discover the various steps that led to the "Azure_Translator_Interface.py" python script

>>> jupyter notebook notebook.ipynb

Running the project

Once installed, the project can be run in two different modes; one paragraph per request, or a batch of paragraph in each request.

One pararagraph at a time

>>> python3 Azure_Translator_Interface.py

In this mode, the app should should offer to input some text before connecting the Azure translator API in order to detect the language. Finally, it will display the result and offer to input a new bloc on text.

A batch of pragraph

>>> python3 Azure_Translator_Interface.py -f PATH_TO_FILE EXPECTED_LABEL
>>> python3 Azure_Translator_Interface.py -f data/export_hin.txt hin

The PATH_TO_FILE should point to a file in which each line is considered as a paragraph. The EXPECTED_LABEL is used to compute the accuracy and recall. It represents the expected label for the whole batch (up to 100 lines) and tt can be any of the following labels: 'ara', 'eng', 'hin', 'spa' or 'zho'

The app will connect to the Azure translator API in order to detect the language, and it will finally return several score and export the answers to data/export_answers.json

oc_ai_01's People

Contributors

valkea avatar

Watchers

 avatar

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.