Skip to main content

A package that takes a list of URLs and creates a dataframe for machine learning projects using BOW

Project description

pyBrokk

This package allows users to provide a list of URLs for webpages of interest and creates a dataframe with Bag of Words representation that can then later be fed into a machine learning model of their choice. Users also have the option to produce a dataframe with just the raw text of their target webpages to apply the text representation of their choice instead.

Why pyBrokk

There are some libraries and packages that can facilitate this job, from scraping text from a URL to returning it to a bag of words (BOW). However, to the extent of our knowledge, there is no sufficiently handy and straightforward package for this purpose. This package is a tailored combination of BeatifulSoup and CountVectorizer. BeautifulSoup widely used to pull different sources of data from HTML and XML pages, and CountVectorizer is a well-known package to convert a collection of texts to a matrix of token counts.

NOTE:

Some websites do not let users collect their data with web scraping tools. Make sure that your target websites do not refuse your request to collect data before applying this package.

Features

The pyBrokk package includes the following four functions:

  • create_id(): Takes a list of webpage urls formatted as strings as an input and returns a list of unique string identifiers for each webpage based on their url. The identifier is composed of the main webpage name followed by a number.
  • text_from_url() : Takes a list of urls and using Beautiful Soup extracts the raw text from each and creates a dictionary. The keys contain the original URL and the values contain the raw text output as parsed by Beautiful Soup.
  • duster(): Takes a list of urls and uses the above two functions to create a dataframe with the webpage identifiers as a index, the raw url, and the raw text from the webpage with extra line breaks removed.
  • bow(): Takes a string text as an input and returns the list of unique words it contains.

Installation

$ pip install pyBrokk

Usage

  • TODO

Contributing

Interested in contributing? Check out the contributing guidelines and the list of contributors who have contributed to the development of this project thus far. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by these terms.

License

pyBrokk was created by Elena Ganacheva, Mehdi Naji, Mike Guron, Daniel Merigo. It is licensed under the terms of the MIT license.

Credits

pyBrokk was created with cookiecutter and the py-pkgs-cookiecutter template. pyBrokk uses beautiful soup

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybrokk-0.0.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybrokk-0.0.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file pybrokk-0.0.2.tar.gz.

File metadata

  • Download URL: pybrokk-0.0.2.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for pybrokk-0.0.2.tar.gz
Algorithm Hash digest
SHA256 df3c70f03cc6a0d4c85d1d8d1d99b7ceb034e5507b159392ecec7dbf181df45a
MD5 a6b94b27ee7f7d7840754bb2a9d2c8c5
BLAKE2b-256 600fcf2039955abcf9a53c8b889db196c8369930050ded8bedad389b767ab5d7

See more details on using hashes here.

File details

Details for the file pybrokk-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pybrokk-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for pybrokk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9734c22afab7cdd9fbdc715c43fa78c2ec2804b446bb4d9882a0ecc09ca48107
MD5 792709d30887e38431ed30287b99c806
BLAKE2b-256 2625653385a65317f9f67b81b1b82ecb7a5611992e5ead4fc8f4279d0add3ef6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page