Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Repository of OpenClassrooms' AI Engineer path, project #1 : use MS Azure's Cognitive Services to detect the language of some text.

License

Notifications You must be signed in to change notification settings

fleuryc/oc_ingenieur-ia_P1-decouvrez-le-metier-d-ingenieur-ia

Repository files navigation

Codacy Badge Python application CodeQL

Language Detector

Repository of OpenClassrooms' AI Engineer path, project #1.

Goal : use MS Azure's Cognitive Services to detect the language of some text.

Check the presentation for this project : Language Detector - Module Polyglotte presentation

Installation

  1. Install dependencies
$ pip install -r requirements.txt
  1. Create a Translator resource in Azure

Follow Azure's official documentation : Create a Translator resource

  1. Configure your environment

Rename .env.example into .env and set the parameters with the values provided by Azure.

Usage

CLI : Input text

Run python detector-cli.py --text TEXT to detect the language of the text passed as an argument.

$ python detector-cli.py --text "We are the knights who say 'Ni!'"
> Detected language : en

CLI : Random text from dataset

Run python detector-cli.py to detect the language of a random line of text in one of the most spoken languages (en, zh, hi, es, ar and fr) from the dataset (data/x_test.txt).

$ python detector-cli.py
> Text : عملية التقويم أي إذا كان هناك درجات للنشاط يحاسب عليها التلميذ في تقصيره وتفاعلة أداء ذلك إلى التحاق بالنشاط و الإمكانيات المتاحة أي إذا كان هناك توفير الأدوات والأنشطة وتوفرت الأماكن كان النشاط كثير و أخيراً التوجيه نحو الإنجاز بمعنى إذا قام المدير بتكريم أداء ذلك إلى تفعيل النشاط.
>
> Expected language : ar
> Detected language : ar
> Result: SUCCESS

Test

Run pytest to check that the language of the most spoken languages is correctly detected.

About

Repository of OpenClassrooms' AI Engineer path, project #1 : use MS Azure's Cognitive Services to detect the language of some text.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published