Giter VIP home page Giter VIP logo

arienox / text-analysis Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 9 KB

The Python script performs text processing on a set of URLs by extracting article text using BeautifulSoup and creating a directory of text files. It then loads stop word files and NLTK stop words, and creates a positive and negative words dictionary. The script also defines a function to count syllables in a given text.

Python 100.00%

text-analysis's Introduction

Text-Analysis

The code provided is a Python script that performs various text processing tasks on a set of URLs. The script reads an Excel file containing a list of URLs and their associated IDs, and then visits each URL using a web driver. It extracts the article text from each URL using BeautifulSoup, and saves the text to a text file named after the URL ID. The script then creates a directory for these text files and moves them to this directory.

The script then loads several stop word files and NLTK stop words, and combines them to create a set of stop words. It reads in two files containing positive and negative words, respectively, and adds the words to a dictionary, excluding those that appear in the stop word set. The script also defines a function to count syllables in a given text.

Next, the script processes each text file in the directory created earlier. It tokenizes the text and removes stop words and punctuation, counts personal pronouns, calculates the polarity and subjectivity scores based on the positive and negative words dictionary, counts the number of sentences, calculates the average number of words per sentence, calculates the Flesch-Kincaid Grade Level, and stores these results in a list. The Flesch-Kincaid Grade Level is a readability score that indicates the minimum education level required to understand a given text.

Overall, the script provides a framework for automated text processing and analysis on a set of URLs. It could be used for tasks such as content analysis, sentiment analysis, or readability analysis. However, it is important to note that the script has limitations and assumptions, such as relying on the accuracy of the web driver to extract article text, and the quality and completeness of the stop word set and positive/negative words dictionary. Additionally, the script may require customization or modification for different text processing needs or languages.

text-analysis's People

Contributors

arienox avatar ranjanakarsh avatar

Watchers

 avatar

text-analysis's Issues

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.