Giter VIP home page Giter VIP logo

webcorpusgenerator's Introduction

Web-Corpus-Generator

This work is supported by the Ministry of Higher Education and Scientific Research in Algeria (Project C00L07UN100120180002) Conception & Supervision : L. Ouahrani & D. Bennouar / Contributor : Abdennour BenHamida.

This code allows to generate a corpus from the web based on keywords related to the subject of the study, cleaned and ready to use. The corpus will be stored in a json file in the same path as the "WebCorp.py" is running. The output contains:

  • Corpus Name
  • Words count : total number of words and diffrent words
  • Articles count: number of wikipedia articles returned into the corpus
  • Articles: a dictionary containing all the textual data returned stored as { Article's title : Content}

1- Requirments:

  • You may need to enable these two commandes if your punkt isn't installed, once dowloaded and installed nltk will work perfectly fine: #1- import nltk #2- nltk.download('punkt')
  • Python 2.7 or later
  • Internet connection
  • At least 20mb of free storage

2- Libraries used:

  • Bs4: BeatifulSoup4 is a python library used for webscrapping (extracting web content from html or xml pages)
  • re.sub: function that alllow as to delete portions of text that are or not in the text
  • word_tokenize: we use to tokenize (split) our texts into a list of words
  • request exception to handle connection errors and timeouts
  • sleep for time out exeptions handling
  • langdetect: a tool that detects languages, so that we don't return any article that is not written in arabic
  • json: storing results

3- How to use:

  • Call the "toJson" function with its two parameters:
    • Keywords: a string with words describing your research or a subject (a bigger keychain leads to a much more detailed corpus and richer content)
    • Nmae: name of the json file that will be created after generation
  • The more keywords you insert, the bigger and more precise the corpus will be

For further questions or inquiries about this code, you can contact:

webcorpusgenerator's People

Contributors

benhamidaabdennour avatar

Stargazers

 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.