Code Monkey home page Code Monkey logo

practicals's Introduction

Practicals

Given as input: a text and a glossary files

  • We compute the frequency of each glossary entry in the input text.
  • We enter all glossary entries found in text in a database (DB), along with their frequencies.
  • We get the machine translation into Spanish of the n most frequent glossary entries found in the input text, using the API (https://libretranslate.com/docs/).
  • We add the translations to the DB.

Steps done:

  • Read the glossary file line-by-line by iterating over the file object of the glossary file in a for loop, lowercase and strip the line then add the glossary in a dictionary as a key with a zero frequency as its value.
  • In a similar fashion, read the input text file line-by-line, preprocess the line by lowercasing and removing stopwords and any non-alphabetical words (punctuations, etc), then increase the frequency of every found glossary in the preprocessed line (if found).
  • Then add all found glossaries in the input text along with their frequency in a ‘frequencies’ table in the database, where all glossaries can be found in the ‘glossary’ column, and all their corresponding frequencies in the ‘frequency’ column.
  • Query the ‘frequencies’ table in the DB to select the top 10 frequent glossaries. Then using the ‘libretranslate’ API, get their spanish translation. Finally, insert the n top frequent glossaries and their translations into the ‘translation’ table in the DB.

practicals's People

Contributors

mariaafara 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.